赵士淞
2023-02-02 72f203e8e7321908fc075fbd2fe609e23b86572c
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java
@@ -96,6 +96,15 @@
            // 查询用户角色
            List<RoleSmallDto> roleSet = roleService.findByUsersId(userId);
            if (roleSet.stream().anyMatch(role -> DataScopeEnum.find(role.getDataScope()) == DataScopeEnum.THIS_LEVEL)) {
               // 根据用户ID查询负责的项目ID
               List<Long> projectIdList = projectRepository.findIdByLiableUserId(userId);
               // 根据用户ID查询参与的项目ID
                List<Long> taskUserProjectIdList = projectCostRepository.findProjectIdByUserId(userId);
                // 检索条件
                List<Long> totalProjectIdList = Stream.of(taskUserProjectIdList, projectIdList).flatMap(Collection::stream).distinct().collect(Collectors.toList());
                if (totalProjectIdList.size() == 0) {
                   return PageUtil.toPage(Collections.emptyList(), 0);
                }
               criteria.setLiableUserId(userId);
            }
       }