From d7b0dc91d5d8ee66eb710286b7f47d26564aa55d Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期三, 11 十二月 2024 18:12:31 +0800 Subject: [PATCH] update 优化 去除部门查询状态校验 改为前端过滤 便于查看禁用部门下的其他数据 --- ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDataScopeServiceImpl.java | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDataScopeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDataScopeServiceImpl.java index 018f9a0..470646f 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDataScopeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDataScopeServiceImpl.java @@ -5,13 +5,14 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.RequiredArgsConstructor; +import org.dromara.common.core.constant.CacheNames; import org.dromara.common.core.utils.StreamUtils; -import org.dromara.common.mybatis.helper.DataBaseHelper; import org.dromara.system.domain.SysDept; import org.dromara.system.domain.SysRoleDept; import org.dromara.system.mapper.SysDeptMapper; import org.dromara.system.mapper.SysRoleDeptMapper; import org.dromara.system.service.ISysDataScopeService; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.List; @@ -37,6 +38,7 @@ * @param roleId 瑙掕壊Id * @return 閮ㄩ棬Id缁� */ + @Cacheable(cacheNames = CacheNames.SYS_ROLE_CUSTOM, key = "#roleId") @Override public String getRoleCustom(Long roleId) { if (ObjectUtil.isNull(roleId)) { @@ -58,14 +60,13 @@ * @param deptId 閮ㄩ棬Id * @return 閮ㄩ棬Id缁� */ + @Cacheable(cacheNames = CacheNames.SYS_DEPT_AND_CHILD, key = "#deptId") @Override public String getDeptAndChild(Long deptId) { if (ObjectUtil.isNull(deptId)) { return "-1"; } - List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>() - .select(SysDept::getDeptId) - .apply(DataBaseHelper.findInSet(deptId, "ancestors"))); + List<SysDept> deptList = deptMapper.selectListByParentId(deptId); List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId); ids.add(deptId); if (CollUtil.isNotEmpty(ids)) { -- Gitblit v1.9.3