|
@@ -52,18 +52,20 @@ public class SysDeptOrganServiceImpl implements SysDeptOrganService {
|
|
|
List<SysDeptOrgan> organs = deptOrganMapper.selectList(wrapper);
|
|
|
String[] ancestors = sysDept.getAncestors().split(",");
|
|
|
//上级(除了顶级组织的每一级)
|
|
|
- for (int i = 2; i < ancestors.length; i++) {
|
|
|
- LambdaQueryWrapper<SysDeptOrgan> wrapperT = new LambdaQueryWrapper<>();
|
|
|
- List<SysDeptOrgan> organsT;
|
|
|
- if (!ObjectUtils.isEmpty(ancestors[i]) && !ancestors[i].equals("0")) {
|
|
|
- String did = ancestors[i];
|
|
|
- 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 (ancestors.length > 2) {
|
|
|
+ for (int i = 2; i < ancestors.length; i++) {
|
|
|
+ LambdaQueryWrapper<SysDeptOrgan> wrapperT = new LambdaQueryWrapper<>();
|
|
|
+ List<SysDeptOrgan> organsT;
|
|
|
+ if (!ObjectUtils.isEmpty(ancestors[i])) {
|
|
|
+ String did = ancestors[i];
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|