Explorar el Código

机关指导处

buzhanyi hace 1 año
padre
commit
8f86c1f205

+ 10 - 12
purchase-system/src/main/java/com/ozs/system/service/impl/SysDeptOrganServiceImpl.java

@@ -74,20 +74,18 @@ public class SysDeptOrganServiceImpl implements SysDeptOrganService {
             wrapper.eq(SysDeptOrgan::getDeptId, deptId);
             String[] ancestors = sysDept.getAncestors().split(",");
             //上级(除了顶级组织的每一级)
-            if (ancestors.length > 2) {
-                for (int i = 2; i < ancestors.length; i++) {
+            if (ancestors.length > 1) {
+                for (int i = 1; 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);
-                        }
+                    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);
                     }
                 }
             }