feat:部门权限
This commit is contained in:
1 parent
47d6fd77d0
commit
d127f0be1e
2 files changed
+16
-5
No files matched your search
+1
-1
@@ -101,7 +101,7 @@ public class SysDeptController {
|
||||
} catch (Exception e) {
|
||||
log.error("获取当前用户ID异常", e);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(parentId)) {
|
||||
if (ObjectUtil.isEmpty(parentId)) {
|
||||
parentId = deptId;
|
||||
}
|
||||
return R.ok(sysDeptService.selectTree(deptName, parentId));
|
||||
|
||||
+15
-4
@@ -133,9 +133,15 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
*/
|
||||
@Override
|
||||
public List<Tree<Long>> selectTree(String deptName, Long parentId) {
|
||||
// 查询全部部门
|
||||
List<SysDept> deptAllList = deptMapper
|
||||
.selectList(Wrappers.<SysDept>lambdaQuery().like(StrUtil.isNotBlank(deptName), SysDept::getName, deptName));
|
||||
List<SysDept> deptAllList = new ArrayList<>();
|
||||
if (ObjectUtil.isEmpty(parentId)) {
|
||||
// 查询全部部门
|
||||
deptAllList = deptMapper
|
||||
.selectList(Wrappers.<SysDept>lambdaQuery().like(StrUtil.isNotBlank(deptName), SysDept::getName, deptName));
|
||||
} else {
|
||||
deptAllList = listDescendant(parentId);
|
||||
}
|
||||
|
||||
// 查询数据权限内部门
|
||||
List<Long> deptOwnIdList = deptMapper
|
||||
.selectListByScope(
|
||||
@@ -173,7 +179,12 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(parentId)) {
|
||||
SysDept parentDept = getById(parentId);
|
||||
if (ObjectUtil.isNotEmpty(parentDept) && ObjectUtil.isNotEmpty(parentDept.getParentId())) {
|
||||
parentId = parentDept.getParentId();
|
||||
}
|
||||
}
|
||||
return TreeUtil.build(collect, parentId == null ? 0 : parentId);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user