|
@@ -50,17 +50,21 @@ public class SysDeptOrganServiceImpl implements SysDeptOrganService {
|
|
|
LambdaQueryWrapper<SysDeptOrgan> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(SysDeptOrgan::getDeptId, deptId);
|
|
|
List<SysDeptOrgan> organs = deptOrganMapper.selectList(wrapper);
|
|
|
- //上级
|
|
|
- LambdaQueryWrapper<SysDeptOrgan> wrapperT = new LambdaQueryWrapper<>();
|
|
|
- List<SysDeptOrgan> organsT;
|
|
|
- if (sysDept.getParentId() != 0) {
|
|
|
- wrapperT.eq(SysDeptOrgan::getDeptId, sysDept.getParentId());
|
|
|
- organsT = deptOrganMapper.selectList(wrapperT);
|
|
|
- SysDept sysDeptTwo = sysDeptMapper.selectDeptById(sysDept.getParentId());
|
|
|
- if (ObjectUtils.isEmpty(organsT)) {
|
|
|
- hashMap.put(sysDeptTwo.getDeptName() + "(暂无数据)", organsT);
|
|
|
- } else {
|
|
|
- hashMap.put(sysDeptTwo.getDeptName(), organsT);
|
|
|
+ String[] ancestors = sysDept.getAncestors().split(",");
|
|
|
+ //上级(除了顶级组织的每一级)
|
|
|
+ for (int i = 1; i < ancestors.length; i++) {
|
|
|
+ String did = ancestors[i];
|
|
|
+ LambdaQueryWrapper<SysDeptOrgan> wrapperT = new LambdaQueryWrapper<>();
|
|
|
+ List<SysDeptOrgan> organsT;
|
|
|
+ if (ObjectUtils.isEmpty(did) && !did.equals("0")) {
|
|
|
+ wrapperT.eq(SysDeptOrgan::getDeptId, did);
|
|
|
+ organsT = deptOrganMapper.selectList(wrapperT);
|
|
|
+ SysDept sysDeptTwo = sysDeptMapper.selectDeptById(Long.parseLong(did));
|
|
|
+ if (ObjectUtils.isEmpty(organsT)) {
|
|
|
+ hashMap.put(sysDeptTwo.getDeptName() + "(暂无数据)", organsT);
|
|
|
+ } else {
|
|
|
+ hashMap.put(sysDeptTwo.getDeptName(), organsT);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(sysDept)) {
|