|
|
|
@ -6,6 +6,7 @@ import com.yunxi.scm.framework.common.enums.CommonStatusEnum;
|
|
|
|
|
import com.yunxi.scm.framework.datapermission.core.annotation.DataPermission;
|
|
|
|
|
import com.yunxi.scm.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO;
|
|
|
|
|
import com.yunxi.scm.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
|
|
|
|
import com.yunxi.scm.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO;
|
|
|
|
|
import com.yunxi.scm.module.system.controller.admin.dept.vo.dept.DeptUpdateReqVO;
|
|
|
|
|
import com.yunxi.scm.module.system.convert.dept.DeptConvert;
|
|
|
|
|
import com.yunxi.scm.module.system.dal.dataobject.dept.DeptDO;
|
|
|
|
@ -40,8 +41,6 @@ public class DeptServiceImpl implements DeptService {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private DeptMapper deptMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private AdminUserService userService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@CacheEvict(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST,
|
|
|
|
@ -206,30 +205,17 @@ public class DeptServiceImpl implements DeptService {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DeptDO> buildTree(List<DeptDO> deptDOList, long pid) {
|
|
|
|
|
List<DeptDO> treeList = new ArrayList<>();
|
|
|
|
|
for (DeptDO dept : deptDOList) {
|
|
|
|
|
if (dept.getParentId() == pid) {
|
|
|
|
|
dept.setChildren(buildTree(deptDOList, dept.getId()));
|
|
|
|
|
treeList.add(dept);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return treeList;
|
|
|
|
|
}
|
|
|
|
|
// @Override
|
|
|
|
|
// public List<DeptSimpleRespVO> buildTree(List<DeptSimpleRespVO> deptDOList, long pid) {
|
|
|
|
|
// List<DeptSimpleRespVO> treeList = new ArrayList<>();
|
|
|
|
|
// for (DeptSimpleRespVO dept : deptDOList) {
|
|
|
|
|
// if (dept.getParentId() == pid) {
|
|
|
|
|
// dept.setChildren(buildTree(deptDOList, dept.getId()));
|
|
|
|
|
// treeList.add(dept);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return treeList;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DeptDO> setBuildTree(List<DeptDO> deptDOList) {
|
|
|
|
|
List<DeptDO> tree = new ArrayList<>();
|
|
|
|
|
for (DeptDO deptDO : deptDOList) {
|
|
|
|
|
if (deptDO.getChildren() != null && deptDO.getChildren().size()>0) {
|
|
|
|
|
setBuildTree(deptDO.getChildren());
|
|
|
|
|
}else{
|
|
|
|
|
List<AdminUserDO> adminUserDOList = userService.getUserListByDeptIds(Collections.singleton(deptDO.getId()));
|
|
|
|
|
deptDO.setChildren(adminUserDOList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tree;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|