瀏覽代碼

修改查询子部门列表接口

tags/V1.3.3
wanjing 10 月之前
父節點
當前提交
3946589a9f
共有 1 個文件被更改,包括 13 次插入4 次删除
  1. +13
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryChildListService.java

+ 13
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryChildListService.java 查看文件

@@ -3,6 +3,8 @@ package com.tuoheng.admin.service.dept.query;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
@@ -13,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
@@ -35,17 +38,23 @@ public class QueryChildListService {
* @return
*/
public JsonResult getChildList(String deptId) {
log.info("进入查询子部门列表业务");
String tenantId = CurrentUserUtil.getTenantId();
User user = CurrentUserUtil.getUserInfo();
String tenantId = user.getTenantId();
JsonResult result = this.check(tenantId, deptId);
if (0 != result.getCode()) {
log.info("根据id查询子部门列表业务:校验失败:{}", result.getMsg());
return result;
}
List<String> deptIdList = deptMapper.selectAllChildListById(deptId);
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.error(QueryDeptChildListCodeEnum.DEPT_LIST_IS_FAILED.getCode(), QueryDeptChildListCodeEnum.DEPT_LIST_IS_FAILED.getMsg());
return JsonResult.success();
}
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
return JsonResult.success(deptList);

Loading…
取消
儲存