部门树列表添加数据权限条件过滤

This commit is contained in:
dataprince 2023-11-27 20:47:05 +08:00
parent 568acfda82
commit 7e4fb37ab6
2 changed files with 4 additions and 3 deletions

View File

@ -44,7 +44,7 @@ mybatis-flex:
# 指定为HikariDataSource # 指定为HikariDataSource
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/jjry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
username: root123 username: root123
password: Root@369---0000 password: Root@369---0000

View File

@ -26,7 +26,6 @@ import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.core.annotation.DataScope;
import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.core.text.Convert; import com.ruoyi.common.core.core.text.Convert;
import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.exception.ServiceException;
@ -52,6 +51,8 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
private SysDeptMapper deptMapper; private SysDeptMapper deptMapper;
@Resource @Resource
private ISysRoleService sysRoleService; private ISysRoleService sysRoleService;
@Resource
private ISysDataScopeService dataScopeService;
@Override @Override
public QueryWrapper query() { public QueryWrapper query() {
@ -93,7 +94,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
*/ */
@Override @Override
public List<SysDeptVo> selectDeptList(SysDeptBo deptBo) { public List<SysDeptVo> selectDeptList(SysDeptBo deptBo) {
QueryWrapper queryWrapper = buildQueryWrapper(deptBo); QueryWrapper queryWrapper = dataScopeService.addCondition(buildQueryWrapper(deptBo));
return this.listAs(queryWrapper, SysDeptVo.class); return this.listAs(queryWrapper, SysDeptVo.class);
} }