|
@@ -170,6 +170,7 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
public Predicate toPredicate(Root<GkjyrEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
|
|
|
boolean xkzflag = false;
|
|
|
+ boolean xkzflag1 = false;
|
|
|
boolean bwflag = false;
|
|
|
|
|
|
List<Predicate> list = new ArrayList<Predicate>();
|
|
@@ -217,13 +218,17 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
}
|
|
|
// 是否危货企业
|
|
|
if (StringUtils.isNotEmpty(sfcswhzy)) {
|
|
|
- if (!sfcswhzy.equals("all")) {
|
|
|
- list.add(cb.like(root.get("sfwhqy").get("id").as(String.class), "%" + sfcswhzy + "%"));
|
|
|
+ if ("201".equals(sfcswhzy)) {
|
|
|
+ list.add(cb.equal(root.get("sfwhqy").get("id").as(String.class), "201"));
|
|
|
+ } else if ("202".equals(sfcswhzy)) {
|
|
|
+ list.add((cb.or(cb.equal(root.get("sfwhqy").get("id").as(String.class), "202"), cb.isNotNull(root.get("sfwhqy").get("id").as(String.class)))));
|
|
|
}
|
|
|
} else if (isGET(request)) {
|
|
|
String sfcswhzy = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "sfcswhzy");
|
|
|
- if (!"all".equals(sfcswhzy)) {
|
|
|
- CacheSearchCondition.predicateList(list, cacheSCmap, root, cb, "id", "sfwhqy", "sfcswhzy");
|
|
|
+ if ("201".equals(sfcswhzy)) {
|
|
|
+ list.add(cb.equal(root.get("sfwhqy").get("id").as(String.class), "201"));
|
|
|
+ } else if ("202".equals(sfcswhzy)) {
|
|
|
+ list.add((cb.or(cb.equal(root.get("sfwhqy").get("id").as(String.class), "202"), cb.isNull(root.get("sfwhqy").get("id").as(String.class)))));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -296,6 +301,54 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ Subquery<XkzxxEntity> subquery1 = query.subquery(XkzxxEntity.class);
|
|
|
+ Root<XkzxxEntity> dpRoot1 = subquery1.from(XkzxxEntity.class);
|
|
|
+ subquery1.select(dpRoot1);
|
|
|
+ List<Predicate> subQueryPredicates1 = new ArrayList<Predicate>();
|
|
|
+ // 是否有许可证
|
|
|
+ if (StringUtils.isNotEmpty(sfcyxkz)) {
|
|
|
+ if (!sfcyxkz.equals("all")) {
|
|
|
+ if ("201".equals(sfcyxkz)) {
|
|
|
+ subQueryPredicates1.add(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)));
|
|
|
+ subQueryPredicates1.add(cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ xkzflag1 = true;
|
|
|
+ } else {
|
|
|
+ // subQueryPredicates.add(cb.or(cb.notEqual(dpRoot.get("gkjyr").as(String.class),
|
|
|
+ // root.get("id").as(String.class)),
|
|
|
+ // cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class),
|
|
|
+ // root.get("id").as(String.class))),
|
|
|
+ // cb.notEqual(dpRoot.get("recordStatus").as(Integer.class),
|
|
|
+ // BaseEntity.RECORD_STATE_VALID)));
|
|
|
+ Predicate p1 = cb.notEqual(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class));
|
|
|
+ Predicate p2 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.notEqual(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ Predicate p3 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.notEqual(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ subQueryPredicates1.add(cb.or(p1, p2, p3));
|
|
|
+ xkzflag1 = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (isGET(request)) {
|
|
|
+ String sfcyxkzval = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "sfcyxkz");
|
|
|
+ if (!"all".equals(sfcyxkzval) && StringUtils.isNotEmpty(sfcyxkzval)) {
|
|
|
+ if ("201".equals(sfcyxkzval)) {
|
|
|
+ subQueryPredicates1.add(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)));
|
|
|
+ subQueryPredicates1.add(cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ xkzflag1 = true;
|
|
|
+ } else {
|
|
|
+ Predicate p1 = cb.notEqual(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class));
|
|
|
+ Predicate p2 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.notEqual(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ Predicate p3 = cb.and(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot1.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.notEqual(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
+ subQueryPredicates1.add(cb.or(p1, p2, p3));
|
|
|
+ xkzflag1 = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (xkzflag1) {
|
|
|
+ subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
+ list.add(cb.exists(subquery1));
|
|
|
+ }
|
|
|
// 子查询
|
|
|
Subquery<XkzxxEntity> subquery = query.subquery(XkzxxEntity.class);
|
|
|
Root<XkzxxEntity> dpRoot = subquery.from(XkzxxEntity.class);
|
|
@@ -338,39 +391,6 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
xkzflag = true;
|
|
|
}
|
|
|
}
|
|
|
- // 是否有许可证
|
|
|
- if (StringUtils.isNotEmpty(sfcyxkz)) {
|
|
|
- if (!sfcyxkz.equals("all")) {
|
|
|
- if (!sfcyxkz.equals("201")) {
|
|
|
- subQueryPredicates.add(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)));
|
|
|
- subQueryPredicates.add(cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
- subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
- xkzflag = true;
|
|
|
- } else {
|
|
|
- // subQueryPredicates.add(cb.or(cb.notEqual(dpRoot.get("gkjyr").as(String.class),
|
|
|
- // root.get("id").as(String.class)),
|
|
|
- // cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class),
|
|
|
- // root.get("id").as(String.class))),
|
|
|
- // cb.notEqual(dpRoot.get("recordStatus").as(Integer.class),
|
|
|
- // BaseEntity.RECORD_STATE_VALID)));
|
|
|
- subQueryPredicates.add(cb.not(cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID))));
|
|
|
- xkzflag = true;
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (isGET(request)) {
|
|
|
- String sfcyxkzval = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "sfcyxkz");
|
|
|
- if (!"all".equals(sfcyxkzval) && StringUtils.isNotEmpty(sfcyxkzval)) {
|
|
|
- if (!"201".equals(sfcyxkzval)) {
|
|
|
- subQueryPredicates.add(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)));
|
|
|
- subQueryPredicates.add(cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
- subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
|
- xkzflag = true;
|
|
|
- } else {
|
|
|
- subQueryPredicates.add(cb.not(cb.and(cb.equal(dpRoot.get("gkjyr").as(String.class), root.get("id").as(String.class)), cb.equal(dpRoot.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID), cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID))));
|
|
|
- xkzflag = true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
// 许可证是否将到期
|
|
|
if (StringUtils.isNotEmpty(jyrxkzsfdq)) {
|
|
@@ -381,8 +401,8 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
|
|
|
xkzflag = true;
|
|
|
} else {
|
|
|
- // subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class),
|
|
|
- // DateTime.addDays(now, 30)));
|
|
|
+ subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), DateTime.addDays(now, 30)));
|
|
|
+ xkzflag = true;
|
|
|
}
|
|
|
} else {
|
|
|
String jyrxkzsfdqval = (String) CacheSearchCondition.cacheSCmapVal(cacheSCmap, "jyrxkzsfdq");
|
|
@@ -394,8 +414,8 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
|
|
|
xkzflag = true;
|
|
|
} else {
|
|
|
- // subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class),
|
|
|
- // DateTime.addDays(now, 30)));
|
|
|
+ subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), DateTime.addDays(now, 30)));
|
|
|
+ xkzflag = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2599,8 +2619,7 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
|
subQueryPredicates.add(cb.greaterThan(dpRoot.get("yxqz").as(Date.class), now));
|
|
|
xkzflag = true;
|
|
|
} else {
|
|
|
- // subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class),
|
|
|
- // DateTime.addDays(now, 30)));
|
|
|
+ subQueryPredicates.add(cb.lessThanOrEqualTo(dpRoot.get("yxqz").as(Date.class), DateTime.addDays(now, 30)));
|
|
|
}
|
|
|
}
|
|
|
if (xkzflag) {
|