Просмотр исходного кода

orcale null 不等于空导致的列表错误

zhourui 5 лет назад
Родитель
Сommit
e2d4feee97

+ 4 - 4
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/factory/Attachment2Factory.java

@@ -26,7 +26,7 @@ public class Attachment2Factory extends AbstractFactory {
 		Root<Attachment2> root = cq.from(Attachment2.class);
 		Predicate p = cb.equal(root.get(Attachment2_.person), person);
 		p = cb.and(p, cb.equal(root.get(Attachment2_.status), "正常"));
-		p = cb.and(p, cb.equal(root.get(Attachment2_.folder), ""));
+		p = cb.and(p, cb.or(cb.isNull(root.get(Attachment2_.folder)), cb.equal(root.get(Attachment2_.folder), "")));
 		cq.select(root.get(Attachment2_.id)).where(p);
 		return em.createQuery(cq).getResultList();
 	}
@@ -37,7 +37,7 @@ public class Attachment2Factory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Attachment2> root = cq.from(Attachment2.class);
 		Predicate p = cb.equal(root.get(Attachment2_.folder), folder);
-		if(StringUtils.isNotEmpty(status)){
+		if (StringUtils.isNotEmpty(status)) {
 			p = cb.and(p, cb.equal(root.get(Attachment2_.status), status));
 		}
 		cq.select(root.get(Attachment2_.id)).where(p);
@@ -65,7 +65,7 @@ public class Attachment2Factory extends AbstractFactory {
 		p = cb.and(p, cb.equal(root.get(Attachment2_.status), "正常"));
 		cq.select(cb.sum(root.get(Attachment2_.length))).where(p);
 		Long sum = em.createQuery(cq).getSingleResult();
-		return sum==null ? 0 : sum;
+		return sum == null ? 0 : sum;
 	}
 
 	public List<Attachment2> listWithFolder2(String folder, String status) throws Exception {
@@ -74,7 +74,7 @@ public class Attachment2Factory extends AbstractFactory {
 		CriteriaQuery<Attachment2> cq = cb.createQuery(Attachment2.class);
 		Root<Attachment2> root = cq.from(Attachment2.class);
 		Predicate p = cb.equal(root.get(Attachment2_.folder), folder);
-		if(StringUtils.isNotEmpty(status)){
+		if (StringUtils.isNotEmpty(status)) {
 			p = cb.and(p, cb.equal(root.get(Attachment2_.status), status));
 		}
 		return em.createQuery(cq.where(p)).getResultList();

+ 1 - 1
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/factory/AttachmentFactory.java

@@ -25,7 +25,7 @@ public class AttachmentFactory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Attachment> root = cq.from(Attachment.class);
 		Predicate p = cb.equal(root.get(Attachment_.person), person);
-		p = cb.and(p, cb.equal(root.get(Attachment_.folder), ""));
+		p = cb.and(p, cb.or(cb.isNull(root.get(Attachment_.folder)), cb.equal(root.get(Attachment_.folder), "")));
 		cq.select(root.get(Attachment_.id)).where(p);
 		return em.createQuery(cq).getResultList();
 	}

+ 5 - 6
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/factory/Folder2Factory.java

@@ -28,7 +28,7 @@ public class Folder2Factory extends AbstractFactory {
 		Root<Folder2> root = cq.from(Folder2.class);
 		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_.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);
 		return em.createQuery(cq).getResultList();
 	}
@@ -40,7 +40,7 @@ public class Folder2Factory extends AbstractFactory {
 		Root<Folder2> root = cq.from(Folder2.class);
 		Predicate p = cb.equal(root.get(Folder2_.person), person);
 		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));
 		}
 		cq.select(root.get(Folder2_.id)).where(p);
@@ -65,7 +65,7 @@ public class Folder2Factory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Folder2> root = cq.from(Folder2.class);
 		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));
 		}
 		cq.select(root.get(Folder2_.id)).where(p);
@@ -88,7 +88,7 @@ public class Folder2Factory extends AbstractFactory {
 		CriteriaQuery<Folder2> cq = cb.createQuery(Folder2.class);
 		Root<Folder2> root = cq.from(Folder2.class);
 		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));
 		}
 		return em.createQuery(cq.where(p)).getResultList();
@@ -104,8 +104,7 @@ public class Folder2Factory extends AbstractFactory {
 		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);
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<Long> cq = cb.createQuery(Long.class);

+ 1 - 1
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/factory/FolderFactory.java

@@ -27,7 +27,7 @@ public class FolderFactory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Folder> root = cq.from(Folder.class);
 		Predicate p = cb.equal(root.get(Folder_.person), person);
-		p = cb.and(p, cb.equal(root.get(Folder_.superior), ""));
+		p = cb.and(p, cb.or(cb.isNull(root.get(Folder_.superior)), cb.equal(root.get(Folder_.superior), "")));
 		cq.select(root.get(Folder_.id)).where(p);
 		return em.createQuery(cq).getResultList();
 	}

+ 1 - 1
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/attachment/ActionListWithEditor.java

@@ -22,7 +22,7 @@ class ActionListWithEditor extends BaseAction {
 			Business business = new Business(emc);
 			List<String> ids = business.attachment().listWithPersonWithEditor(owner,
 					effectivePerson.getDistinguishedName());
-			List<Wo> wos = Wo.copier.copy(emc.list(Attachment.class, ids));
+					List<Wo> wos = Wo.copier.copy(emc.list(Attachment.class, ids));
 			for (Wo o : wos) {
 				o.setContentType(this.contentType(false, o.getName()));
 			}

+ 4 - 4
o2server/x_file_assemble_control/src/main/webapp/describe/sources/com/x/file/assemble/control/factory/Attachment2Factory.java

@@ -26,7 +26,7 @@ public class Attachment2Factory extends AbstractFactory {
 		Root<Attachment2> root = cq.from(Attachment2.class);
 		Predicate p = cb.equal(root.get(Attachment2_.person), person);
 		p = cb.and(p, cb.equal(root.get(Attachment2_.status), "正常"));
-		p = cb.and(p, cb.equal(root.get(Attachment2_.folder), ""));
+		p = cb.and(p, cb.or(cb.isNull(root.get(Attachment2_.folder)), cb.equal(root.get(Attachment2_.folder), "")));
 		cq.select(root.get(Attachment2_.id)).where(p);
 		return em.createQuery(cq).getResultList();
 	}
@@ -37,7 +37,7 @@ public class Attachment2Factory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Attachment2> root = cq.from(Attachment2.class);
 		Predicate p = cb.equal(root.get(Attachment2_.folder), folder);
-		if(StringUtils.isNotEmpty(status)){
+		if (StringUtils.isNotEmpty(status)) {
 			p = cb.and(p, cb.equal(root.get(Attachment2_.status), status));
 		}
 		cq.select(root.get(Attachment2_.id)).where(p);
@@ -65,7 +65,7 @@ public class Attachment2Factory extends AbstractFactory {
 		p = cb.and(p, cb.equal(root.get(Attachment2_.status), "正常"));
 		cq.select(cb.sum(root.get(Attachment2_.length))).where(p);
 		Long sum = em.createQuery(cq).getSingleResult();
-		return sum==null ? 0 : sum;
+		return sum == null ? 0 : sum;
 	}
 
 	public List<Attachment2> listWithFolder2(String folder, String status) throws Exception {
@@ -74,7 +74,7 @@ public class Attachment2Factory extends AbstractFactory {
 		CriteriaQuery<Attachment2> cq = cb.createQuery(Attachment2.class);
 		Root<Attachment2> root = cq.from(Attachment2.class);
 		Predicate p = cb.equal(root.get(Attachment2_.folder), folder);
-		if(StringUtils.isNotEmpty(status)){
+		if (StringUtils.isNotEmpty(status)) {
 			p = cb.and(p, cb.equal(root.get(Attachment2_.status), status));
 		}
 		return em.createQuery(cq.where(p)).getResultList();

+ 1 - 1
o2server/x_file_assemble_control/src/main/webapp/describe/sources/com/x/file/assemble/control/factory/AttachmentFactory.java

@@ -25,7 +25,7 @@ public class AttachmentFactory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Attachment> root = cq.from(Attachment.class);
 		Predicate p = cb.equal(root.get(Attachment_.person), person);
-		p = cb.and(p, cb.equal(root.get(Attachment_.folder), ""));
+		p = cb.and(p, cb.or(cb.isNull(root.get(Attachment_.folder)), cb.equal(root.get(Attachment_.folder), "")));
 		cq.select(root.get(Attachment_.id)).where(p);
 		return em.createQuery(cq).getResultList();
 	}

+ 5 - 6
o2server/x_file_assemble_control/src/main/webapp/describe/sources/com/x/file/assemble/control/factory/Folder2Factory.java

@@ -28,7 +28,7 @@ public class Folder2Factory extends AbstractFactory {
 		Root<Folder2> root = cq.from(Folder2.class);
 		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_.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);
 		return em.createQuery(cq).getResultList();
 	}
@@ -40,7 +40,7 @@ public class Folder2Factory extends AbstractFactory {
 		Root<Folder2> root = cq.from(Folder2.class);
 		Predicate p = cb.equal(root.get(Folder2_.person), person);
 		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));
 		}
 		cq.select(root.get(Folder2_.id)).where(p);
@@ -65,7 +65,7 @@ public class Folder2Factory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Folder2> root = cq.from(Folder2.class);
 		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));
 		}
 		cq.select(root.get(Folder2_.id)).where(p);
@@ -88,7 +88,7 @@ public class Folder2Factory extends AbstractFactory {
 		CriteriaQuery<Folder2> cq = cb.createQuery(Folder2.class);
 		Root<Folder2> root = cq.from(Folder2.class);
 		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));
 		}
 		return em.createQuery(cq.where(p)).getResultList();
@@ -104,8 +104,7 @@ public class Folder2Factory extends AbstractFactory {
 		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);
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<Long> cq = cb.createQuery(Long.class);

+ 1 - 1
o2server/x_file_assemble_control/src/main/webapp/describe/sources/com/x/file/assemble/control/factory/FolderFactory.java

@@ -27,7 +27,7 @@ public class FolderFactory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Folder> root = cq.from(Folder.class);
 		Predicate p = cb.equal(root.get(Folder_.person), person);
-		p = cb.and(p, cb.equal(root.get(Folder_.superior), ""));
+		p = cb.and(p, cb.or(cb.isNull(root.get(Folder_.superior)), cb.equal(root.get(Folder_.superior), "")));
 		cq.select(root.get(Folder_.id)).where(p);
 		return em.createQuery(cq).getResultList();
 	}

+ 1 - 1
o2server/x_file_assemble_control/src/main/webapp/describe/sources/com/x/file/assemble/control/jaxrs/attachment/ActionListWithEditor.java

@@ -22,7 +22,7 @@ class ActionListWithEditor extends BaseAction {
 			Business business = new Business(emc);
 			List<String> ids = business.attachment().listWithPersonWithEditor(owner,
 					effectivePerson.getDistinguishedName());
-			List<Wo> wos = Wo.copier.copy(emc.list(Attachment.class, ids));
+					List<Wo> wos = Wo.copier.copy(emc.list(Attachment.class, ids));
 			for (Wo o : wos) {
 				o.setContentType(this.contentType(false, o.getName()));
 			}