|
|
@@ -2,6 +2,7 @@ package com.x.file.assemble.control.factory;
|
|
|
|
|
|
import com.x.file.assemble.control.AbstractFactory;
|
|
|
import com.x.file.assemble.control.Business;
|
|
|
+import com.x.file.core.entity.open.FileStatus;
|
|
|
import com.x.file.core.entity.personal.Attachment2;
|
|
|
import com.x.file.core.entity.personal.Attachment2_;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -25,7 +26,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_.person), person);
|
|
|
- p = cb.and(p, cb.equal(root.get(Attachment2_.status), "正常"));
|
|
|
+ p = cb.and(p, cb.equal(root.get(Attachment2_.status), FileStatus.VALID.getName()));
|
|
|
p = cb.and(p, cb.equal(root.get(Attachment2_.folder), Business.TOP_FOLD));
|
|
|
cq.select(root.get(Attachment2_.id)).where(p);
|
|
|
return em.createQuery(cq).getResultList();
|
|
|
@@ -50,7 +51,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_.person), person);
|
|
|
- p = cb.and(p, cb.equal(root.get(Attachment2_.status), "正常"));
|
|
|
+ p = cb.and(p, cb.equal(root.get(Attachment2_.status), FileStatus.VALID.getName()));
|
|
|
p = cb.and(p, cb.like(root.get(Attachment2_.name), "%" + name + "%"));
|
|
|
cq.select(root.get(Attachment2_.id)).where(p);
|
|
|
return em.createQuery(cq).setMaxResults(100).getResultList();
|
|
|
@@ -62,7 +63,7 @@ public class Attachment2Factory extends AbstractFactory {
|
|
|
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
|
|
|
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_.status), FileStatus.VALID.getName()));
|
|
|
cq.select(cb.sum(root.get(Attachment2_.length))).where(p);
|
|
|
Long sum = em.createQuery(cq).getSingleResult();
|
|
|
return sum == null ? 0 : sum;
|