作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们正在对实体进行搜索,我们正在使用 Query DSL。
表结构如下
TableA : shop -> has manytoOne relationship to TableB : Discount
BooleanExpression A = shop.id.eq(SomeId);
BooleanExpression B = shop.name.eq(SomeName)
BooleanExpression C = shop.discount.isNotNull;
BooleanExpression D = shop.discount.isNull;
BooleanExpression E = shop.disccount.approved.eq(SomeValue)
A
.and(B)
.and(D .or(C.and(D).and(E))
)
where shop.id=#someid and shop.name = 'some name' and (shop.discount is Null Or (shop.discount is not null and shop.approved='#some Value'))
where shop.id=`#someid` and shop.name = `'some name'` and (shop.discount is Null Or shop.discount is not null and shop.approved='`#some Value`')
最佳答案
A.and(B).and(D .or(C.and(D).and(E)))
A and B and (D or C and D and E)
shop.discount.isNull()
.or(shop.discount.isNotNull()
.and(shop.discount.approved.eq(SomeValue)))
关于QueryDSL AND/OR 运算符不适用于 BooleanExpression,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23509502/
我是一名优秀的程序员,十分优秀!