|
|
@@ -1,10 +1,6 @@
|
|
|
package com.goafanti.organization.service.impl;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.UUID;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import com.goafanti.common.dao.DepartmentMapper;
|
|
|
import com.goafanti.common.model.Department;
|
|
|
@@ -74,30 +70,31 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
|
|
|
if (hideSign>1){
|
|
|
hideSign=null;
|
|
|
}
|
|
|
- List<DepOut> depList=departmentMapper.selectSuperId(hideSign,3,null);
|
|
|
- depList.forEach(e ->{
|
|
|
- List<DepOut> list=getSubordinateDep(1,e.getId());
|
|
|
- if (!list.isEmpty()){
|
|
|
- e.setList(list);
|
|
|
+ List<DepOut> allDep=departmentMapper.selectSuperId(hideSign,null,null);
|
|
|
+
|
|
|
+ List<DepOut> dep1=new ArrayList<>();
|
|
|
+ Integer x=3;//设置顶级
|
|
|
+ for (DepOut e : allDep) {
|
|
|
+ if (e.getLvl()==x){
|
|
|
+ e.setList(selectDepLvl(allDep,e.getId(),x+1));
|
|
|
+ dep1.add(e);
|
|
|
}
|
|
|
- });
|
|
|
- return depList;
|
|
|
+ }
|
|
|
+ return dep1;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- */
|
|
|
- public List<DepOut> getSubordinateDep(Integer hideSign,String id){
|
|
|
- List<DepOut> depList=departmentMapper.selectSuperId(hideSign,null,id);
|
|
|
- depList.forEach(e ->{
|
|
|
- List<DepOut> list=getSubordinateDep(1,e.getId());
|
|
|
- if (!list.isEmpty()){
|
|
|
- e.setList(list);
|
|
|
+ private List<DepOut> selectDepLvl(List<DepOut> allDep,String id, Integer i) {
|
|
|
+ List<DepOut> newDep=new ArrayList<>();
|
|
|
+ for (DepOut depOut : allDep) {
|
|
|
+ if (depOut.getLvl()==i&&depOut.getSuperId().equals(id)){
|
|
|
+ if (i<7)depOut.setList(selectDepLvl(allDep,depOut.getId(),i+1));
|
|
|
+ newDep.add(depOut);
|
|
|
}
|
|
|
- });
|
|
|
- return depList;
|
|
|
+ }
|
|
|
+ return newDep;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* XXIn form 提交 ,bo包中
|
|
|
* xxOut 输出 bo包中
|