Skip to content

Commit f0ed88c

Browse files
authored
support FIND_IN_SET cond (elunez#745)
* fix weird prefixes keys when use RedisUtils.scan * Column use `` for reserved key ref: https://stackoverflow.com/questions/2224503/how-to-map-an-entity-field-whose-name-is-a-reserved-word-in-jpa * add FIND_IN_SET 条件查询 * note
1 parent f72efb8 commit f0ed88c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ enum Type {
7474
// 不为空
7575
,NOT_NULL
7676
// 为空
77-
,IS_NULL
77+
,IS_NULL,
78+
// Aborn Jiang 2022/06/01, 对应SQL: SELECT * FROM table WHERE FIND_IN_SET('querytag', table.tags);
79+
FIND_IN_SET
7880
}
7981

8082
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ public static <R, Q> Predicate getPredicate(Root<R> root, Q query, CriteriaBuild
166166
(Comparable) between.get(0), (Comparable) between.get(1)));
167167
}
168168
break;
169+
case FIND_IN_SET:
170+
list.add(cb.greaterThan(cb.function("FIND_IN_SET", Integer.class,
171+
cb.literal(val.toString()), root.get(attributeName)), 0));
172+
break;
169173
default: break;
170174
}
171175
}

0 commit comments

Comments
 (0)