| | |
| | | String propName = q.propName(); |
| | | String joinName = q.joinName(); |
| | | String blurry = q.blurry(); |
| | | // wcd加 |
| | | String isOr = q.isOr(); |
| | | // |
| | | String attributeName = isBlank(propName) ? field.getName() : propName; |
| | | Class<?> fieldType = field.getType(); |
| | | Object val = field.get(query); |
| | |
| | | String[] blurrys = blurry.split(","); |
| | | List<Predicate> orPredicate = new ArrayList<>(); |
| | | for (String s : blurrys) { |
| | | orPredicate.add(cb.like(root.get(s) |
| | | .as(String.class), "%" + val.toString() + "%")); |
| | | String[] joinNames = s.split(">"); |
| | | if (joinNames.length == 2) { |
| | | orPredicate.add(cb.like(root.join(joinNames[0], JoinType.LEFT).get(joinNames[1]) |
| | | .as(String.class), "%" + val.toString() + "%")); |
| | | } else { |
| | | orPredicate.add(cb.like(root.get(joinNames[0]) |
| | | .as(String.class), "%" + val.toString() + "%")); |
| | | } |
| | | } |
| | | Predicate[] p = new Predicate[orPredicate.size()]; |
| | | list.add(cb.or(orPredicate.toArray(p))); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // wcd加 |
| | | if (ObjectUtil.isNotEmpty(isOr)) { |
| | | String[] isOrs = isOr.split(","); |
| | | List<Predicate> orP = new ArrayList<>(); |
| | | for (String s : isOrs) { |
| | | orP.add(cb.equal(root.get(s) |
| | | .as(String.class), val)); |
| | | } |
| | | Predicate[] orpr = new Predicate[orP.size()]; |
| | | list.add(cb.or(orP.toArray(orpr))); |
| | | continue; |
| | | } |
| | | // |
| | | |
| | | switch (q.type()) { |
| | | case EQUAL: |
| | | list.add(cb.equal(getExpression(attributeName,join,root) |