Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support FIND_IN_SET cond #745

Merged
merged 6 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add FIND_IN_SET 条件查询
  • Loading branch information
aborn committed Jun 1, 2022
commit 64ef258cf9225f35ebbe692e1871f1bbcff61fda
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', md_markdown_meta.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 @@ -164,6 164,10 @@ public static <R, Q> Predicate getPredicate(Root<R> root, Q query, CriteriaBuild
list.add(cb.between(getExpression(attributeName, join, root).as((Class<? extends Comparable>) between.get(0).getClass()),
(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