|
@@ -28,7 +28,7 @@ public class Folder2Factory extends AbstractFactory {
|
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
|
Predicate p = cb.equal(root.get(Folder2_.person), person);
|
|
Predicate p = cb.equal(root.get(Folder2_.person), person);
|
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), "正常"));
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), "正常"));
|
|
|
- p = cb.and(p, cb.equal(root.get(Folder2_.superior), ""));
|
|
|
|
|
|
|
+ p = cb.and(p, cb.or(cb.isNull(root.get(Folder2_.superior)), cb.equal(root.get(Folder2_.superior), "")));
|
|
|
cq.select(root.get(Folder2_.id)).where(p);
|
|
cq.select(root.get(Folder2_.id)).where(p);
|
|
|
return em.createQuery(cq).getResultList();
|
|
return em.createQuery(cq).getResultList();
|
|
|
}
|
|
}
|
|
@@ -40,7 +40,7 @@ public class Folder2Factory extends AbstractFactory {
|
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
|
Predicate p = cb.equal(root.get(Folder2_.person), person);
|
|
Predicate p = cb.equal(root.get(Folder2_.person), person);
|
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.superior), superior));
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.superior), superior));
|
|
|
- if(StringUtils.isNotEmpty(status)){
|
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), status));
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), status));
|
|
|
}
|
|
}
|
|
|
cq.select(root.get(Folder2_.id)).where(p);
|
|
cq.select(root.get(Folder2_.id)).where(p);
|
|
@@ -65,7 +65,7 @@ public class Folder2Factory extends AbstractFactory {
|
|
|
CriteriaQuery<String> cq = cb.createQuery(String.class);
|
|
CriteriaQuery<String> cq = cb.createQuery(String.class);
|
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
|
Predicate p = cb.equal(root.get(Folder2_.superior), id);
|
|
Predicate p = cb.equal(root.get(Folder2_.superior), id);
|
|
|
- if(StringUtils.isNotEmpty(status)){
|
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), status));
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), status));
|
|
|
}
|
|
}
|
|
|
cq.select(root.get(Folder2_.id)).where(p);
|
|
cq.select(root.get(Folder2_.id)).where(p);
|
|
@@ -88,7 +88,7 @@ public class Folder2Factory extends AbstractFactory {
|
|
|
CriteriaQuery<Folder2> cq = cb.createQuery(Folder2.class);
|
|
CriteriaQuery<Folder2> cq = cb.createQuery(Folder2.class);
|
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
Root<Folder2> root = cq.from(Folder2.class);
|
|
|
Predicate p = cb.equal(root.get(Folder2_.superior), id);
|
|
Predicate p = cb.equal(root.get(Folder2_.superior), id);
|
|
|
- if(StringUtils.isNotEmpty(status)){
|
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(status)) {
|
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), status));
|
|
p = cb.and(p, cb.equal(root.get(Folder2_.status), status));
|
|
|
}
|
|
}
|
|
|
return em.createQuery(cq.where(p)).getResultList();
|
|
return em.createQuery(cq.where(p)).getResultList();
|
|
@@ -104,8 +104,7 @@ public class Folder2Factory extends AbstractFactory {
|
|
|
return em.createQuery(cq).getSingleResult();
|
|
return em.createQuery(cq).getSingleResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean exist(String person, String name, String superior,
|
|
|
|
|
- String excludeId) throws Exception {
|
|
|
|
|
|
|
+ public boolean exist(String person, String name, String superior, String excludeId) throws Exception {
|
|
|
EntityManager em = this.entityManagerContainer().get(Folder2.class);
|
|
EntityManager em = this.entityManagerContainer().get(Folder2.class);
|
|
|
CriteriaBuilder cb = em.getCriteriaBuilder();
|
|
CriteriaBuilder cb = em.getCriteriaBuilder();
|
|
|
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
|
|
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
|