querydslbindings不能将多个别名与路径结合

发布于 2025-01-24 20:34:14 字数 668 浏览 3 评论 0原文

让我们首先看一下代码,以下是我将两个别名绑定到root的方式。同时创建的date,但只有一个总是生效的,最后一个别名终点将始终覆盖先前的启动,我希望既开始启动又有终点。为了同时有效,我该怎么办?

@Override
default void customize(QuerydslBindings bindings, QPointLog root) {
    bindings.bind(root.member.username, root.memo).first((path, value) -> path.likeIgnoreCase("%" + EscapeCharacter.of('!').escape(value) + "%", '!'));

    // The following is how I bind multiple aliases to a path
    bindings.bind(root.createdDate).as("beginDate").first((path, value) -> new BooleanBuilder(path.goe(value)));
    bindings.bind(root.createdDate).as("endDate").first((path, value) -> new BooleanBuilder(path.loe(value))); // invalid
}

Let's look at the code first, the following is how I bind two aliases to root.createdDate at the same time, but only one will always take effect, and the last alias endDate will always override the previous beginDate,I want both beginDate and endDate to be valid at the same time, what should I do?

@Override
default void customize(QuerydslBindings bindings, QPointLog root) {
    bindings.bind(root.member.username, root.memo).first((path, value) -> path.likeIgnoreCase("%" + EscapeCharacter.of('!').escape(value) + "%", '!'));

    // The following is how I bind multiple aliases to a path
    bindings.bind(root.createdDate).as("beginDate").first((path, value) -> new BooleanBuilder(path.goe(value)));
    bindings.bind(root.createdDate).as("endDate").first((path, value) -> new BooleanBuilder(path.loe(value))); // invalid
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文