|
@@ -8,6 +8,8 @@ import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import javax.persistence.EntityManager;
|
|
|
|
+import javax.persistence.PersistenceContext;
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
import javax.persistence.criteria.CriteriaBuilder.In;
|
|
import javax.persistence.criteria.CriteriaBuilder.In;
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
@@ -170,7 +172,6 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
public Predicate toPredicate(Root<GkjyrEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
public Predicate toPredicate(Root<GkjyrEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
|
|
|
boolean xkzflag = false;
|
|
boolean xkzflag = false;
|
|
- boolean xkzflag1 = false;
|
|
|
|
boolean bwflag = false;
|
|
boolean bwflag = false;
|
|
|
|
|
|
List<Predicate> list = new ArrayList<Predicate>();
|
|
List<Predicate> list = new ArrayList<Predicate>();
|
|
@@ -313,19 +314,14 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
subQueryPredicates1.add(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)));
|
|
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("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
- xkzflag1 = true;
|
|
|
|
|
|
+ subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
|
+ list.add(cb.exists(subquery1));
|
|
} else {
|
|
} 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;
|
|
|
|
|
|
+ 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));
|
|
|
|
+ subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
|
+ list.add(cb.not(cb.exists(subquery1)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (isGET(request)) {
|
|
} else if (isGET(request)) {
|
|
@@ -335,20 +331,17 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
subQueryPredicates1.add(cb.equal(dpRoot1.get("gkjyr").as(String.class), root.get("id").as(String.class)));
|
|
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("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
subQueryPredicates1.add(cb.equal(dpRoot1.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
- xkzflag1 = true;
|
|
|
|
|
|
+ subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
|
+ list.add(cb.exists(subquery1));
|
|
} else {
|
|
} 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;
|
|
|
|
|
|
+ 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));
|
|
|
|
+ subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
|
+ list.add(cb.not(cb.exists(subquery1)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (xkzflag1) {
|
|
|
|
- subquery1.where(subQueryPredicates1.toArray(new Predicate[] {}));
|
|
|
|
- list.add(cb.exists(subquery1));
|
|
|
|
- }
|
|
|
|
// 子查询
|
|
// 子查询
|
|
Subquery<XkzxxEntity> subquery = query.subquery(XkzxxEntity.class);
|
|
Subquery<XkzxxEntity> subquery = query.subquery(XkzxxEntity.class);
|
|
Root<XkzxxEntity> dpRoot = subquery.from(XkzxxEntity.class);
|
|
Root<XkzxxEntity> dpRoot = subquery.from(XkzxxEntity.class);
|
|
@@ -421,6 +414,7 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
}
|
|
}
|
|
|
|
|
|
if (xkzflag) {
|
|
if (xkzflag) {
|
|
|
|
+ subQueryPredicates.add(cb.equal(dpRoot.get("sfyx").as(Integer.class), BaseEntity.RECORD_STATE_VALID));
|
|
subquery.where(subQueryPredicates.toArray(new Predicate[] {}));
|
|
subquery.where(subQueryPredicates.toArray(new Predicate[] {}));
|
|
list.add(cb.exists(subquery));
|
|
list.add(cb.exists(subquery));
|
|
}
|
|
}
|
|
@@ -448,7 +442,7 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
return cb.and(list.toArray(new Predicate[] {}));
|
|
return cb.and(list.toArray(new Predicate[] {}));
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
if (page.getPage() < 1) {
|
|
if (page.getPage() < 1) {
|
|
page.setPage(SearchCondition.jyrpage);
|
|
page.setPage(SearchCondition.jyrpage);
|
|
}
|
|
}
|
|
@@ -488,7 +482,6 @@ public class GkjyrCtl extends BaseWebCtl {
|
|
voList.add(vo);
|
|
voList.add(vo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
if (isPOST(request)) {
|
|
if (isPOST(request)) {
|
|
SearchCondition.jyrpage = page.getPage();
|
|
SearchCondition.jyrpage = page.getPage();
|
|
// cacheSCmap.put("jyrpage", page.getPage());
|
|
// cacheSCmap.put("jyrpage", page.getPage());
|