Skip to content

Commit e1c434b

Browse files
committed
[代码优化](v2.6):@query 加入 NOT_IN 查询
1 parent 8c6571f commit e1c434b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

eladmin-common/src/main/java/me/zhengjie/annotation/Query.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ enum Type {
6565
, LESS_THAN_NQ
6666
// jie 2019/6/4 包含
6767
, IN
68+
// 不包含
69+
, NOT_IN
6870
// 不等于
6971
,NOT_EQUAL
7072
// between

eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,13 @@ public static <R, Q> Predicate getPredicate(Root<R> root, Q query, CriteriaBuild
141141
.as(String.class), val.toString() + "%"));
142142
break;
143143
case IN:
144-
if (CollUtil.isNotEmpty((Collection<Long>)val)) {
145-
list.add(getExpression(attributeName,join,root).in((Collection<Long>) val));
144+
if (CollUtil.isNotEmpty((Collection<Object>)val)) {
145+
list.add(getExpression(attributeName,join,root).in((Collection<Object>) val));
146+
}
147+
break;
148+
case NOT_IN:
149+
if (CollUtil.isNotEmpty((Collection<Object>)val)) {
150+
list.add(getExpression(attributeName,join,root).in((Collection<Object>) val).not());
146151
}
147152
break;
148153
case NOT_EQUAL:

0 commit comments

Comments
 (0)