Commit b46d50fe authored by Zheng Jie's avatar Zheng Jie
Browse files
parent cf3655ad
...@@ -53,6 +53,7 @@ public class QueryHelp { ...@@ -53,6 +53,7 @@ public class QueryHelp {
} }
} }
try { try {
Map<String, Join> joinKey = new HashMap<>();
List<Field> fields = getAllFields(query.getClass(), new ArrayList<>()); List<Field> fields = getAllFields(query.getClass(), new ArrayList<>());
for (Field field : fields) { for (Field field : fields) {
boolean accessible = field.isAccessible(); boolean accessible = field.isAccessible();
...@@ -75,14 +76,15 @@ public class QueryHelp { ...@@ -75,14 +76,15 @@ public class QueryHelp {
String[] blurrys = blurry.split(","); String[] blurrys = blurry.split(",");
List<Predicate> orPredicate = new ArrayList<>(); List<Predicate> orPredicate = new ArrayList<>();
for (String s : blurrys) { for (String s : blurrys) {
orPredicate.add(cb.like(root.get(s) orPredicate.add(cb.like(root.get(s).as(String.class), "%" + val.toString() + "%"));
.as(String.class), "%" + val.toString() + "%"));
} }
Predicate[] p = new Predicate[orPredicate.size()]; Predicate[] p = new Predicate[orPredicate.size()];
list.add(cb.or(orPredicate.toArray(p))); list.add(cb.or(orPredicate.toArray(p)));
continue; continue;
} }
if (ObjectUtil.isNotEmpty(joinName)) { if (ObjectUtil.isNotEmpty(joinName)) {
join = joinKey.get(joinName);
if(join == null){
String[] joinNames = joinName.split(">"); String[] joinNames = joinName.split(">");
for (String name : joinNames) { for (String name : joinNames) {
switch (q.join()) { switch (q.join()) {
...@@ -110,6 +112,8 @@ public class QueryHelp { ...@@ -110,6 +112,8 @@ public class QueryHelp {
default: break; default: break;
} }
} }
joinKey.put(joinName, join);
}
} }
switch (q.type()) { switch (q.type()) {
case EQUAL: case EQUAL:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment