Skip to content

Commit

Permalink
support FIND_IN_SET cond (elunez#745)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
aborn authored Jul 4, 2023
1 parent f72efb8 commit f0ed88c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ enum Type {
// 不为空
,NOT_NULL
// 为空
,IS_NULL
,IS_NULL,
// Aborn Jiang 2022/06/01, 对应SQL: SELECT * FROM table WHERE FIND_IN_SET('querytag', table.tags);
FIND_IN_SET
}

/**
Expand Down
4 changes: 4 additions & 0 deletions eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ public static <R, Q> Predicate getPredicate(Root<R> root, Q query, CriteriaBuild
(Comparable) between.get(0), (Comparable) between.get(1)));
}
break;
case FIND_IN_SET:
list.add(cb.greaterThan(cb.function("FIND_IN_SET", Integer.class,
cb.literal(val.toString()), root.get(attributeName)), 0));
break;
default: break;
}
}
Expand Down

0 comments on commit f0ed88c

Please sign in to comment.