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 0c9cabad2..0f25de038 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,15 +1,10 @@ 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.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.youlai.admin.pojo.entity.SysRole; -import com.youlai.admin.pojo.entity.SysUser; +import com.youlai.admin.pojo.query.RolePageQuery; 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; import java.util.List; @@ -18,11 +13,12 @@ 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); + @DataPermission(deptAlias = "d",userAlias = "u") + Page listRolePages(Page page, RolePageQuery queryParams,boolean isRoot,String rootCode); + + + @DataPermission(deptAlias = "d",userAlias = "u") + List listDeptOptions(boolean isRoot,String rootCode); } diff --git a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysRoleServiceImpl.java b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysRoleServiceImpl.java index ecf5c85a7..648c59ec3 100644 --- a/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysRoleServiceImpl.java +++ b/youlai-admin/admin-boot/src/main/java/com/youlai/admin/service/impl/SysRoleServiceImpl.java @@ -59,19 +59,7 @@ public class SysRoleServiceImpl extends ServiceImpl impl // 查询参数 int pageNum = queryParams.getPageNum(); int pageSize = queryParams.getPageSize(); - String keywords = queryParams.getKeywords(); - - // 查询数据 - Page rolePage = this.page( - new Page<>(pageNum, pageSize), - new LambdaQueryWrapper() - .like(StrUtil.isNotBlank(keywords), SysRole::getName, keywords) - .or() - .like(StrUtil.isNotBlank(keywords), SysRole::getCode, keywords) - .ne(!UserUtils.isRoot(), SysRole::getCode, GlobalConstants.ROOT_ROLE_CODE) // 非超级管理员不显示超级管理员角色 - .select(SysRole::getId, SysRole::getName, SysRole::getCode,SysRole::getDataScope) - ); - + Page rolePage = this.baseMapper.listRolePages( new Page<>(pageNum, pageSize), queryParams,UserUtils.isRoot(),GlobalConstants.ROOT_ROLE_CODE); // 实体转换 Page pageResult = roleConverter.entity2Page(rolePage); return pageResult; @@ -85,12 +73,7 @@ public class SysRoleServiceImpl extends ServiceImpl impl @Override public List