issues #I1546S

This commit is contained in:
thinkgem
2020-02-19 19:23:48 +08:00
parent c15312083d
commit acf6ea7738
2 changed files with 17 additions and 15 deletions

View File

@@ -123,6 +123,14 @@ public class Office extends TreeEntity<Office> {
this.officeType = officeType; this.officeType = officeType;
} }
public String[] getOfficeType_in(){
return sqlMap.getWhere().getValue("office_type", QueryType.IN);
}
public void setOfficeType_in(String[] officeTypes){
sqlMap.getWhere().and("office_type", QueryType.IN, officeTypes);
}
@Length(min=0, max=100, message="负责人长度不能超过 100 个字符") @Length(min=0, max=100, message="负责人长度不能超过 100 个字符")
public String getLeader() { public String getLeader() {
return leader; return leader;

View File

@@ -235,6 +235,15 @@ public class OfficeController extends BaseController {
if (!(isAll != null && isAll) || Global.isStrictMode()){ if (!(isAll != null && isAll) || Global.isStrictMode()){
officeService.addDataScopeFilter(where, ctrlPermi); officeService.addDataScopeFilter(where, ctrlPermi);
} }
// 根据父节点过滤数据
if (StringUtils.isNotBlank(parentCode)){
where.setParentCode(parentCode);
where.setParentCodes(","+parentCode+",");
}
// 根据部门类型过滤数据
if (StringUtils.isNotBlank(officeTypes)){
where.setOfficeType_in(officeTypes.split(","));
}
List<Office> list = officeService.findList(where); List<Office> list = officeService.findList(where);
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
Office e = list.get(i); Office e = list.get(i);
@@ -251,21 +260,6 @@ public class OfficeController extends BaseController {
continue; continue;
} }
} }
// 根据父节点过滤数据
if (StringUtils.isNotBlank(parentCode)){
if (!e.getOfficeCode().equals(parentCode)){
continue;
}
if (!e.getParentCodes().contains("," + parentCode + ",")){
continue;
}
}
// 根据部门类型过滤数据
if (StringUtils.isNotBlank(officeTypes)){
if (!StringUtils.inString(e.getOfficeType(), officeTypes.split(","))){
continue;
}
}
Map<String, Object> map = MapUtils.newHashMap(); Map<String, Object> map = MapUtils.newHashMap();
map.put("id", e.getId()); map.put("id", e.getId());
map.put("pId", e.getParentCode()); map.put("pId", e.getParentCode());