Browse Source

bugfix:卡务操作-部门查询条件错误;

bing 4 days ago
parent
commit
10e20c4475

+ 5 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@@ -341,9 +341,13 @@ public class SysDeptServiceImpl implements ISysDeptService {
341
 
341
 
342
     @Override
342
     @Override
343
     public List<Long> selectDeptAndChildrenDeptById(Long deptId) {
343
     public List<Long> selectDeptAndChildrenDeptById(Long deptId) {
344
+        SysDeptVo sysDeptVo = baseMapper.selectVoById(deptId);
345
+        if (ObjectUtil.isNull(sysDeptVo)) {
346
+            return CollUtil.newArrayList(deptId);
347
+        }
344
         return baseMapper.selectList(Wrappers.lambdaQuery(SysDept.class)
348
         return baseMapper.selectList(Wrappers.lambdaQuery(SysDept.class)
345
             .select(SysDept::getDeptId)
349
             .select(SysDept::getDeptId)
346
-            .eq(SysDept::getParentId, deptId).or().eq(SysDept::getDeptId, deptId)
350
+            .eq(SysDept::getParentId, deptId).or().eq(SysDept::getDeptId, deptId).or().likeRight(SysDept::getAncestors, sysDeptVo.getAncestors()+","+deptId)
347
         ).stream().map(SysDept::getDeptId).toList();
351
         ).stream().map(SysDept::getDeptId).toList();
348
     }
352
     }
349
 }
353
 }