|
@@ -40,7 +40,9 @@ class ActionListLike extends BaseAction {
|
|
|
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
|
|
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
|
|
|
Business business = new Business(emc);
|
|
Business business = new Business(emc);
|
|
|
String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getKey(),
|
|
String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getKey(),
|
|
|
- StringUtils.join(wi.getUnitList(), ","));
|
|
|
|
|
|
|
+ StringUtils.join(wi.getUnitList(), ","),
|
|
|
|
|
+ StringUtils.join(wi.getUnitDutyList(), ","),
|
|
|
|
|
+ StringUtils.join(wi.getGroupList(), ","));
|
|
|
Element element = business.cache().get(cacheKey);
|
|
Element element = business.cache().get(cacheKey);
|
|
|
if (null != element && (null != element.getObjectValue())) {
|
|
if (null != element && (null != element.getObjectValue())) {
|
|
|
result.setData((List<Wo>) element.getObjectValue());
|
|
result.setData((List<Wo>) element.getObjectValue());
|
|
@@ -61,6 +63,8 @@ class ActionListLike extends BaseAction {
|
|
|
private List<String> unitList = new ArrayList<>();
|
|
private List<String> unitList = new ArrayList<>();
|
|
|
@FieldDescribe("搜索职务范围,为空则不限定")
|
|
@FieldDescribe("搜索职务范围,为空则不限定")
|
|
|
private List<String> unitDutyList = new ArrayList<>();
|
|
private List<String> unitDutyList = new ArrayList<>();
|
|
|
|
|
+ @FieldDescribe("搜索群组范围(仅限群组的身份成员),为空则不限定")
|
|
|
|
|
+ private List<String> groupList = new ArrayList<>();
|
|
|
|
|
|
|
|
public String getKey() {
|
|
public String getKey() {
|
|
|
return key;
|
|
return key;
|
|
@@ -86,6 +90,13 @@ class ActionListLike extends BaseAction {
|
|
|
this.unitDutyList = unitDutyList;
|
|
this.unitDutyList = unitDutyList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public List<String> getGroupList() {
|
|
|
|
|
+ return groupList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void setGroupList(List<String> groupList) {
|
|
|
|
|
+ this.groupList = groupList;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static class Wo extends Identity {
|
|
public static class Wo extends Identity {
|
|
@@ -107,11 +118,12 @@ class ActionListLike extends BaseAction {
|
|
|
CriteriaBuilder cb = em.getCriteriaBuilder();
|
|
CriteriaBuilder cb = em.getCriteriaBuilder();
|
|
|
CriteriaQuery<Identity> cq = cb.createQuery(Identity.class);
|
|
CriteriaQuery<Identity> cq = cb.createQuery(Identity.class);
|
|
|
Root<Identity> root = cq.from(Identity.class);
|
|
Root<Identity> root = cq.from(Identity.class);
|
|
|
- Predicate p = cb.like(cb.lower(root.get(Identity_.name)), "%" + str + "%", StringTools.SQL_ESCAPE_CHAR);
|
|
|
|
|
- p = cb.or(p, cb.like(cb.lower(root.get(Identity_.unique)), "%" + str + "%", StringTools.SQL_ESCAPE_CHAR));
|
|
|
|
|
- p = cb.or(p, cb.like(cb.lower(root.get(Identity_.pinyin)), str + "%", StringTools.SQL_ESCAPE_CHAR));
|
|
|
|
|
- p = cb.or(p, cb.like(cb.lower(root.get(Identity_.pinyinInitial)), str + "%", StringTools.SQL_ESCAPE_CHAR));
|
|
|
|
|
- p = cb.or(p, cb.like(cb.lower(root.get(Identity_.distinguishedName)), str + "%", StringTools.SQL_ESCAPE_CHAR));
|
|
|
|
|
|
|
+ Predicate p = cb.conjunction();
|
|
|
|
|
+ p = cb.and(p, cb.or(cb.like(cb.lower(root.get(Identity_.name)), "%" + str + "%", StringTools.SQL_ESCAPE_CHAR),
|
|
|
|
|
+ cb.like(cb.lower(root.get(Identity_.unique)), "%" + str + "%", StringTools.SQL_ESCAPE_CHAR),
|
|
|
|
|
+ cb.like(cb.lower(root.get(Identity_.pinyin)), str + "%", StringTools.SQL_ESCAPE_CHAR),
|
|
|
|
|
+ cb.like(cb.lower(root.get(Identity_.pinyinInitial)), str + "%", StringTools.SQL_ESCAPE_CHAR),
|
|
|
|
|
+ cb.like(cb.lower(root.get(Identity_.distinguishedName)), str + "%", StringTools.SQL_ESCAPE_CHAR)));
|
|
|
if (ListTools.isNotEmpty(wi.getUnitDutyList())) {
|
|
if (ListTools.isNotEmpty(wi.getUnitDutyList())) {
|
|
|
List<UnitDuty> unitDuties = business.unitDuty().pick(wi.getUnitDutyList());
|
|
List<UnitDuty> unitDuties = business.unitDuty().pick(wi.getUnitDutyList());
|
|
|
List<String> unitDutyIdentities = new ArrayList<>();
|
|
List<String> unitDutyIdentities = new ArrayList<>();
|
|
@@ -123,7 +135,15 @@ class ActionListLike extends BaseAction {
|
|
|
}
|
|
}
|
|
|
if (ListTools.isNotEmpty(wi.getUnitList())) {
|
|
if (ListTools.isNotEmpty(wi.getUnitList())) {
|
|
|
List<String> identityIds = business.expendUnitToIdentity(wi.getUnitList());
|
|
List<String> identityIds = business.expendUnitToIdentity(wi.getUnitList());
|
|
|
- p = cb.and(p, root.get(Identity_.id).in(identityIds));
|
|
|
|
|
|
|
+ if(ListTools.isNotEmpty(identityIds)) {
|
|
|
|
|
+ p = cb.and(p, root.get(Identity_.id).in(identityIds));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ListTools.isNotEmpty(wi.getGroupList())) {
|
|
|
|
|
+ List<String> identityIds = business.expendGroupToIdentity(wi.getGroupList());
|
|
|
|
|
+ if(ListTools.isNotEmpty(identityIds)) {
|
|
|
|
|
+ p = cb.and(p, root.get(Identity_.id).in(identityIds));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
List<Identity> os = em.createQuery(cq.select(root).where(p)).getResultList();
|
|
List<Identity> os = em.createQuery(cq.select(root).where(p)).getResultList();
|
|
|
wos = Wo.copier.copy(os);
|
|
wos = Wo.copier.copy(os);
|