|
|
@@ -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() |