Skip to content

Commit

Permalink
[代码优化](v2.6):@query 加入 NOT_IN 查询
Browse files Browse the repository at this point in the history
  • Loading branch information
elunez committed Mar 20, 2021
1 parent 8c6571f commit e1c434b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ enum Type {
, LESS_THAN_NQ
// jie 2019/6/4 包含
, IN
// 不包含
, NOT_IN
// 不等于
,NOT_EQUAL
// between
Expand Down
9 changes: 7 additions & 2 deletions eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,13 @@ public static <R, Q> Predicate getPredicate(Root<R> root, Q query, CriteriaBuild
.as(String.class), val.toString() + "%"));
break;
case IN:
if (CollUtil.isNotEmpty((Collection<Long>)val)) {
list.add(getExpression(attributeName,join,root).in((Collection<Long>) val));
if (CollUtil.isNotEmpty((Collection<Object>)val)) {
list.add(getExpression(attributeName,join,root).in((Collection<Object>) val));
}
break;
case NOT_IN:
if (CollUtil.isNotEmpty((Collection<Object>)val)) {
list.add(getExpression(attributeName,join,root).in((Collection<Object>) val).not());
}
break;
case NOT_EQUAL:
Expand Down

0 comments on commit e1c434b

Please sign in to comment.