From ae12a3400818695d3556eb6ed077db4d1e73e88d Mon Sep 17 00:00:00 2001 From: chuan <2256222053@qq.com> Date: Thu, 22 Sep 2022 00:44:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(youlai-admin):=20=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=92=8C=E8=A7=92=E8=89=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 开启部门和角色数据权限 --- .../youlai/admin/mapper/SysDeptMapper.java | 2 +- .../youlai/admin/mapper/SysRoleMapper.java | 13 +++ .../service/impl/SysDeptServiceImpl.java | 91 ++++++++++++++++++- .../handler/MyDataPermissionHandler.java | 21 +---- 4 files changed, 107 insertions(+), 20 deletions(-) diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java index 007c89675..e53acc3c5 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysDeptMapper.java @@ -13,7 +13,7 @@ import java.util.List; @Mapper public interface SysDeptMapper extends BaseMapper { - // @DataPermission + @DataPermission() @Override List selectList(@Param(Constants.WRAPPER) Wrapper queryWrapper); } diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysRoleMapper.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysRoleMapper.java index d3f0ca29a..0c9cabad2 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysRoleMapper.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/mapper/SysRoleMapper.java @@ -1,8 +1,14 @@ package com.youlai.admin.mapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.youlai.admin.pojo.entity.SysDept; import com.youlai.admin.pojo.entity.SysRole; import com.youlai.admin.pojo.entity.SysUser; +import com.youlai.common.mybatis.annotation.DataPermission; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Mapper; @@ -12,4 +18,11 @@ import java.util.List; public interface SysRoleMapper extends BaseMapper { + @DataPermission() + @Override + List selectList(@Param(Constants.WRAPPER) Wrapper queryWrapper); + + @DataPermission() + > E selectPage(E page, @Param("ew") Wrapper queryWrapper); + } diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java index e28e2f5ec..8f44892d3 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysDeptServiceImpl.java @@ -125,10 +125,12 @@ public class SysDeptServiceImpl extends ServiceImpl impl .select(SysDept::getId, SysDept::getParentId, SysDept::getName) .orderByAsc(SysDept::getSort) ); - List