Browse Source

Merge remote-tracking branch 'origin/master'

houlai 6 months ago
parent
commit
13de0985e7
19 changed files with 150 additions and 21 deletions
  1. 3 0
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentscollegemanage/AidingStudentsCollegeManageController.java
  2. 2 3
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsimportlist/AidingStudentsImportListController.java
  3. 3 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/aidingstudentspersonmanage/AidingStudentsPersonManageDO.java
  4. 1 1
      yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentspersonmanage/AidingStudentsPersonManageServiceImpl.java
  5. 7 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApi.java
  6. 6 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/dto/DeptRespDTO.java
  7. 9 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApi.java
  8. 12 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApiImpl.java
  9. 11 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApiImpl.java
  10. 2 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java
  11. 17 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java
  12. 6 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java
  13. 6 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/DeptDO.java
  14. 0 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java
  15. 18 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/DeptMapper.java
  16. 14 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java
  17. 23 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java
  18. 7 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java
  19. 3 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

+ 3 - 0
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentscollegemanage/AidingStudentsCollegeManageController.java

@@ -42,6 +42,7 @@ public class AidingStudentsCollegeManageController {
     @Operation(summary = "创建家庭困难认定项目学院管理")
     @PreAuthorize("@ss.hasPermission('as:aiding-students-college-manage:create')")
     public CommonResult<Long> createAidingStudentsCollegeManage(@Valid @RequestBody AidingStudentsCollegeManageSaveReqVO createReqVO) {
+        //注意学校id和学院id的区别
         return success(aidingStudentsCollegeManageService.createAidingStudentsCollegeManage(createReqVO));
     }
 
@@ -67,6 +68,8 @@ public class AidingStudentsCollegeManageController {
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('as:aiding-students-college-manage:get')")
     public CommonResult<AidingStudentsCollegeManageRespVO> getAidingStudentsCollegeManage(@RequestParam("id") Long id) {
+        //通过collegeId 和 manageId 获取,减少学院项目id的使用。
+
         AidingStudentsCollegeManageDO aidingStudentsCollegeManage = aidingStudentsCollegeManageService.getAidingStudentsCollegeManage(id);
         return success(BeanUtils.toBean(aidingStudentsCollegeManage, AidingStudentsCollegeManageRespVO.class));
     }

+ 2 - 3
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/controller/admin/aidingstudentsimportlist/AidingStudentsImportListController.java

@@ -85,9 +85,10 @@ public class AidingStudentsImportListController {
     @Parameters({
             @Parameter(name = "aidingStudentsManageId", description = "助学学校项目id", example = "5")
     })
+
     @PreAuthorize("@ss.hasPermission('as:aiding-students-import-list:import')")
     public CommonResult<AidingStudentsImportExcelRespVO> importExcel(@RequestParam(value = "aidingStudentsManageId", required = true) Long aidingStudentsManageId,
-    @RequestParam(value = "redisUUID") String redisUUID)throws Exception {
+    @RequestParam(value = "redisUUID") String redisUUID) throws Exception {
         return success(aidingStudentsImportListService.aidingStudentsImportExcelList( aidingStudentsManageId,redisUUID));
     }
 
@@ -101,8 +102,6 @@ public class AidingStudentsImportListController {
         return success(redisUUID);
     }
 
-
-
     @PostMapping("/reimport-excel")
     @Operation(summary = "重复导入家庭情况困难认定excel")
     @Parameters({

+ 3 - 1
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/dal/dataobject/aidingstudentspersonmanage/AidingStudentsPersonManageDO.java

@@ -25,6 +25,8 @@ public class AidingStudentsPersonManageDO extends BaseDO {
     // 序号
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
+
+
     //姓名
     private String nickname;
     // 困难类型
@@ -36,7 +38,7 @@ public class AidingStudentsPersonManageDO extends BaseDO {
     // 排序
     private Integer sort;
     // 学院id
-    private Integer collegeId;
+    private Long collegeId;
     // 项目ID
     private Integer manageId;
     // 学院项目主键ID

+ 1 - 1
yudao-module-as/yudao-module-as-biz/src/main/java/cn/iocoder/yudao/module/as/service/aidingstudentspersonmanage/AidingStudentsPersonManageServiceImpl.java

@@ -91,7 +91,7 @@ public class AidingStudentsPersonManageServiceImpl extends ServiceImpl<AidingStu
 
         // 学院ID
         Long collegeId = deptApi.getCollegeId(user.getDeptId());
-        aDo.setCollegeId(Math.toIntExact(collegeId));
+        aDo.setCollegeId(collegeId);
         // 学院名称
         DeptRespDTO dept = deptApi.getDept(user.getDeptId());
         aDo.setCollegeName(dept.getName());

+ 7 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApi.java

@@ -67,6 +67,13 @@ public interface DeptApi {
      */
     Long getCollegeId(Long id);
 
+
+    /**
+     * 获取学院数量
+     * @return Long
+     */
+    Long getCollegeNum();
+
     /**
      *  获得子集部门
      *

+ 6 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/dto/DeptRespDTO.java

@@ -34,4 +34,10 @@ public class DeptRespDTO {
      */
     private Integer status;
 
+    /**
+     * 部门状态
+     *
+     * 枚举 {@link CommonStatusEnum}
+     */
+    private String bs;
 }

+ 9 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApi.java

@@ -1,10 +1,15 @@
 package cn.iocoder.yudao.module.system.api.permission;
 
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.module.system.api.permission.dto.DeptDataPermissionRespDTO;
+import org.springframework.validation.annotation.Validated;
 
 import java.util.Collection;
+import java.util.List;
 import java.util.Set;
 
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
 /**
  * 权限 API 接口
  *
@@ -46,4 +51,8 @@ public interface PermissionApi {
      */
     DeptDataPermissionRespDTO getDeptDataPermission(Long userId);
 
+    void assignUserRole(Long userId, Set<Long> roleIds);
+
+    Set<Long> getUserRoleIdListByUserId(Long userId);
+
 }

+ 12 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApiImpl.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.system.api.dept;
 
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
 import cn.iocoder.yudao.module.system.service.dept.DeptService;
@@ -29,6 +30,7 @@ public class DeptApiImpl implements DeptApi {
     }
 
     @Override
+    @DataPermission(enable = false)
     public List<DeptRespDTO> getDeptList(Collection<Long> ids) {
         List<DeptDO> depts = deptService.getDeptList(ids);
         return BeanUtils.toBean(depts, DeptRespDTO.class);
@@ -40,18 +42,27 @@ public class DeptApiImpl implements DeptApi {
     }
 
     @Override
+    @DataPermission(enable = false)
     public List<DeptRespDTO> getChildDeptList(Long id) {
         List<DeptDO> childDeptList = deptService.getChildDeptList(id);
         return BeanUtils.toBean(childDeptList, DeptRespDTO.class);
     }
 
     @Override
+    @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存
     public Long getCollegeId(Long id) {
         Long collegeId = deptService.getCollegeId(id);
         return collegeId;
     }
+    @Override
+    @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存
+    public Long getCollegeNum() {
+        Long collegeId = deptService.getCollegeNum();
+        return collegeId;
+    }
 
-
+    @Override
+    @DataPermission(enable = false)
     public List<DeptRespDTO> getChildDeptListByParent(Long id){
         List<DeptDO> deptList = deptService.getChildDeptListByParent(id);
         return BeanUtils.toBean(deptList, DeptRespDTO.class);

+ 11 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApiImpl.java

@@ -6,6 +6,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.Collection;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -39,4 +40,14 @@ public class PermissionApiImpl implements PermissionApi {
         return permissionService.getDeptDataPermission(userId);
     }
 
+    @Override
+    public void assignUserRole(Long userId, Set<Long> roleIds) {
+        permissionService.assignUserRole(userId,roleIds);
+    }
+
+    @Override
+    public Set<Long> getUserRoleIdListByUserId(Long userId) {
+        return permissionService.getUserRoleIdListByUserId(userId);
+    }
+
 }

+ 2 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java

@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.api.user;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjUtil;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
 import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
 import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
@@ -66,6 +67,7 @@ public class AdminUserApiImpl implements AdminUserApi {
     }
 
     @Override
+    @DataPermission(enable = false)
     public List<AdminUserRespDTO> getUserList(Collection<Long> ids) {
         List<AdminUserDO> users = userService.getUserList(ids);
         return BeanUtils.toBean(users, AdminUserRespDTO.class);

+ 17 - 6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java

@@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.dept;
 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
 import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
@@ -15,12 +17,14 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
-
+import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 
 @Tag(name = "管理后台 - 部门")
 @RestController
@@ -28,9 +32,16 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 @Validated
 public class DeptController {
 
+    @Resource
+    private AdminUserApi adminUserApi;
+    @Resource
+    private DeptApi deptApi;
     @Resource
     private DeptService deptService;
 
+    @Resource
+    private PermissionApi permissionApi;
+
     @PostMapping("create")
     @Operation(summary = "创建部门")
     @PreAuthorize("@ss.hasPermission('system:dept:create')")
@@ -67,15 +78,17 @@ public class DeptController {
     @GetMapping(value = {"/list-all-simple", "/simple-list"})
     @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
     public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptList() {
-        List<DeptDO> list = deptService.getDeptList(
-                new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
+        List<DeptDO> list;
+        list = deptService.getDeptList(new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
         return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
     }
 
     @GetMapping(value = {"/list-all-simple-dept", "/simple-list-dept"})
     @Operation(summary = "获取子部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
     public CommonResult<List<DeptSimpleRespVO>> getSimpleDeptListByDept(@RequestParam("id") Long id) {
-        List<DeptDO> list = deptService.getDeptListByDept(id);
+        Long deptId = adminUserApi.getUser(getLoginUserId()).getDeptId();
+        Long collegeId =  deptApi.getCollegeId(deptId);
+        List<DeptDO> list = deptService.getDeptListByDept(collegeId);
         return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
     }
 
@@ -89,6 +102,4 @@ public class DeptController {
     }
 
 
-
-
 }

+ 6 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java

@@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
+import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
 import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
 import cn.iocoder.yudao.module.system.convert.user.UserConvert;
 import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
@@ -34,6 +36,7 @@ import java.util.Map;
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 
 @Tag(name = "管理后台 - 用户")
 @RestController
@@ -45,6 +48,8 @@ public class UserController {
     private AdminUserService userService;
     @Resource
     private DeptService deptService;
+    @Resource
+    private PermissionApi permissionApi;
 
     @PostMapping("/create")
     @Operation(summary = "新增用户")
@@ -91,6 +96,7 @@ public class UserController {
     @Operation(summary = "获得用户分页列表")
     @PreAuthorize("@ss.hasPermission('system:user:list')")
     public CommonResult<PageResult<UserRespVO>> getUserPage(@Valid UserPageReqVO pageReqVO) {
+
         // 获得用户分页列表
         PageResult<AdminUserDO> pageResult = userService.getUserPage(pageReqVO);
         if (CollUtil.isEmpty(pageResult.getList())) {

+ 6 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/DeptDO.java

@@ -67,4 +67,10 @@ public class DeptDO extends TenantBaseDO {
      */
     private Integer status;
 
+    /**
+     * 部门状态
+     *
+     * 枚举 {@link CommonStatusEnum}
+     */
+    private String type;
 }

+ 0 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java

@@ -33,7 +33,6 @@ public class AdminUserDO extends TenantBaseDO {
      */
     @TableId
     private Long id;
-
     /**
      * 学号
      */

+ 18 - 3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/DeptMapper.java

@@ -17,7 +17,12 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
                 .likeIfPresent(DeptDO::getName, reqVO.getName())
                 .eqIfPresent(DeptDO::getStatus, reqVO.getStatus()));
     }
-
+    default List<DeptDO> selectList(Long collegeId,DeptListReqVO reqVO) {
+        return selectList(new LambdaQueryWrapperX<DeptDO>()
+                .likeIfPresent(DeptDO::getName, reqVO.getName())
+                .eqIfPresent(DeptDO::getStatus, reqVO.getStatus())
+        );
+    }
     default DeptDO selectByParentIdAndName(Long parentId, String name) {
         return selectOne(DeptDO::getParentId, parentId, DeptDO::getName, name);
     }
@@ -30,10 +35,20 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
         return selectList(DeptDO::getParentId, parentIds);
     }
 
-    default List<DeptDO> selectListByParentId(Long id) {
-        return selectList(DeptDO::getParentId, id);
+    default List<DeptDO> selectListByParentIdAndCollege(Long id) {
+        return selectList(
+                new LambdaQueryWrapperX<DeptDO>()
+                        .eqIfPresent(DeptDO::getParentId, id)
+                        .eqIfPresent(DeptDO::getType,"college")
+              );
     }
+    default List<DeptDO> selectListByParentId(Long id) {
+        return selectList(
+                new LambdaQueryWrapperX<DeptDO>()
+                        .eqIfPresent(DeptDO::getParentId, id)
 
+        );
+    }
     default List<DeptDO> selectListByParentIds(List<Long> ids) {
         return selectList(DeptDO::getParentId, ids);
     }

+ 14 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java

@@ -63,6 +63,14 @@ public interface DeptService {
      */
     List<DeptDO> getDeptList(DeptListReqVO reqVO);
 
+    /**
+     * 辅导员获取筛选学院部门列表
+     *
+     * @param reqVO 筛选条件请求 VO
+     * @return 部门列表
+     */
+    List<DeptDO> getDeptListByCollege(Long collegeId,DeptListReqVO reqVO);
+
     /**
      * 筛选部门列表
      * @param id 部门id
@@ -97,6 +105,12 @@ public interface DeptService {
      * @return 子部门列表
      */
     Long getCollegeId(Long id);
+    /**
+     * 获取学院数量
+     * @return Long
+     */
+    Long getCollegeNum();
+
 
     /**
      * 通过固定id查找学院id
@@ -133,5 +147,4 @@ public interface DeptService {
      */
     void validateDeptList(Collection<Long> ids);
 
-//    List<DeptDO> updateSchoolDept();
 }

+ 23 - 3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java

@@ -164,6 +164,7 @@ public class DeptServiceImpl implements DeptService {
     }
 
     @Override
+    @DataPermission(enable = false)
     public List<DeptDO> getDeptList(Collection<Long> ids) {
         if (CollUtil.isEmpty(ids)) {
             return Collections.emptyList();
@@ -177,8 +178,15 @@ public class DeptServiceImpl implements DeptService {
         list.sort(Comparator.comparing(DeptDO::getSort));
         return list;
     }
+    @Override
+    public List<DeptDO> getDeptListByCollege(Long collegeId,DeptListReqVO reqVO) {
+        List<DeptDO> list = deptMapper.selectList(reqVO);
+        list.sort(Comparator.comparing(DeptDO::getSort));
+        return list;
+    }
 
     @Override
+    @DataPermission(enable = false)
     public List<DeptDO> getDeptListByDept(Long id) {
         List<DeptDO> list = getChildDeptList(id);
         list.sort(Comparator.comparing(DeptDO::getSort));
@@ -186,6 +194,7 @@ public class DeptServiceImpl implements DeptService {
     }
 
     @Override
+
     public List<DeptDO> getChildDeptList(Long id) {
         List<DeptDO> children = new LinkedList<>();
         // 遍历每一层
@@ -204,8 +213,15 @@ public class DeptServiceImpl implements DeptService {
         return children;
     }
 
+    @Override
+    @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存
+    public Long getCollegeNum() {
+        List<DeptDO> collegeList = getCollegeListByGlutID(0L);
+        return (long)collegeList.size();
+    }
 
     @Override
+    @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存
     public Long getCollegeId(Long id) {
         List<DeptDO> collegeList = getCollegeListByGlutID(id);
         if(collegeList.isEmpty()){
@@ -215,6 +231,10 @@ public class DeptServiceImpl implements DeptService {
 
         return findCollegeId(id,collegeIdSet);
     }
+
+
+
+    @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存
     public Long findCollegeId(Long id,Set<Long> collegeIdSet) {
         if(collegeIdSet.contains(id)){
             return id;
@@ -228,11 +248,13 @@ public class DeptServiceImpl implements DeptService {
         }
     }
     @Override
+    @DataPermission(enable = false) // 禁用数据权限,避免建立不正确的缓存
     public List<DeptDO> getCollegeListByGlutID(Long id) {
-        return deptMapper.selectListByParentId(0L);
+        return deptMapper.selectListByParentIdAndCollege(0L);
     }
 
     @Override
+    @DataPermission(enable = false)
     public List<DeptDO> getChildDeptListByParent(Long id) {
         return deptMapper.selectListByParentId(id);
     }
@@ -268,6 +290,4 @@ public class DeptServiceImpl implements DeptService {
         });
     }
 
-
-
 }

+ 7 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java

@@ -309,7 +309,13 @@ public class PermissionServiceImpl implements PermissionService {
             }
             // 情况四,DEPT_DEPT_AND_CHILD
             if (Objects.equals(role.getDataScope(), DataScopeEnum.DEPT_AND_CHILD.getScope())) {
-                CollUtil.addAll(result.getDeptIds(), deptService.getChildDeptIdListFromCache(userDeptId.get()));
+                if(hasAnyRoles(userId,"fudaoyuan")){
+                    Long collegeId = deptService.getCollegeId(userService.getUser(userId).getDeptId());
+                    CollUtil.addAll(result.getDeptIds(),deptService.getChildDeptIdListFromCache(collegeId));
+                    CollUtil.addAll(result.getDeptIds(),collegeId);
+                }else {
+                    CollUtil.addAll(result.getDeptIds(), deptService.getChildDeptIdListFromCache(userDeptId.get()));
+                }
                 // 添加本身部门编号
                 CollUtil.addAll(result.getDeptIds(), userDeptId.get());
                 continue;

+ 3 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
 import cn.iocoder.yudao.framework.datapermission.core.util.DataPermissionUtils;
 import cn.iocoder.yudao.module.infra.api.file.FileApi;
 import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
@@ -257,6 +258,7 @@ public class AdminUserServiceImpl implements AdminUserService {
     }
 
     @Override
+    @DataPermission(enable = false)
     public List<AdminUserDO> getUserListByDeptIds(Collection<Long> deptIds) {
         if (CollUtil.isEmpty(deptIds)) {
             return Collections.emptyList();
@@ -277,6 +279,7 @@ public class AdminUserServiceImpl implements AdminUserService {
     }
 
     @Override
+    @DataPermission(enable = false)
     public List<AdminUserDO> getUserList(Collection<Long> ids) {
         if (CollUtil.isEmpty(ids)) {
             return Collections.emptyList();