Browse Source

修改获取部门树形列表接口

tags/V1.3.3
wanjing 1 year ago
parent
commit
cb5c9d3eb5
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeByDeptIdService.java

+ 14
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeByDeptIdService.java View File

@@ -7,6 +7,7 @@ import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.conver.DeptConverMapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.dept.QueryDeptTreeListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
@@ -44,8 +45,19 @@ public class QueryListTreeByDeptIdService {
public JsonResult getListTree(String deptId) {
List<DeptTreeVo> deptTreeVoList = new ArrayList<>();
User user = CurrentUserUtil.getUserInfo();
// 查询当前部门下所有有效的部门数据
List<String> deptIdList = deptMapper.selectAllChildListById(user.getDeptId());

List<String> deptIdList;
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
deptIdList = deptMapper.selectAllChildListById(deptId);
} else {
deptIdList = new ArrayList<>();
deptIdList.add(user.getDeptId());
}
if (CollectionUtil.isEmpty(deptIdList)) {
log.info("获取部门列表为空");
return JsonResult.success();
}

List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
// 找出当前部门
Dept currentDept = deptList.stream()

Loading…
Cancel
Save