diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysDeptController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysDeptController.java index 3bb4be19..c0843538 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysDeptController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysDeptController.java @@ -129,7 +129,7 @@ public class SysDeptController extends BaseController { @SaCheckPermission("system:dept:query") @GetMapping("/optionselect") public R> optionselect(@RequestParam(required = false) Long[] deptIds) { - return R.ok(deptService.selectDeptByIds(List.of(deptIds))); + return R.ok(deptService.selectDeptByIds(deptIds == null ? null : List.of(deptIds))); } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysPostController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysPostController.java index efa4d9fa..15c872f9 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysPostController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysPostController.java @@ -116,7 +116,7 @@ public class SysPostController extends BaseController { @SaCheckPermission("system:post:query") @GetMapping("/optionselect") public R> optionselect(@RequestParam(required = false) Long[] postIds) { - return R.ok(postService.selectPostByIds(List.of(postIds))); + return R.ok(postService.selectPostByIds(postIds == null ? null : List.of(postIds))); } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysRoleController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysRoleController.java index c5be0800..f3db430a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysRoleController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysRoleController.java @@ -155,7 +155,7 @@ public class SysRoleController extends BaseController { @SaCheckPermission("system:role:query") @GetMapping("/optionselect") public R> optionselect(@RequestParam(required = false) Long[] roleIds) { - return R.ok(roleService.selectRoleByIds(List.of(roleIds))); + return R.ok(roleService.selectRoleByIds(roleIds == null ? null : List.of(roleIds))); } /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java index 8a368137..4c21fa51 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java @@ -216,7 +216,7 @@ public class SysUserController extends BaseController { @GetMapping("/optionselect") public R> optionselect(@RequestParam(required = false) Long[] userIds, @RequestParam(required = false) Long deptId) { - return R.ok(userService.selectUserByIds(List.of(userIds), deptId)); + return R.ok(userService.selectUserByIds(userIds == null ? null : List.of(userIds), deptId)); } /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java index d226d997..fc7fc6e1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java @@ -26,6 +26,12 @@ public interface SysUserMapper extends BaseMapperPlus { }) Page selectPageUserList(@Param("page") Page page, @Param(Constants.WRAPPER) Wrapper queryWrapper); + @DataPermission({ + @DataColumn(key = "deptName", value = "dept_id"), + @DataColumn(key = "userName", value = "user_id") + }) + List selectUserList(@Param(Constants.WRAPPER) Wrapper queryWrapper); + /** * 根据条件分页查询用户列表 * diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java index 94e0a255..9c352b20 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java @@ -174,10 +174,9 @@ public class SysRoleServiceImpl implements ISysRoleService { */ @Override public List selectRoleByIds(List roleIds) { - return baseMapper.selectRoleList(new LambdaQueryWrapper() - .select(SysRole::getRoleId, SysRole::getRoleName, SysRole::getRoleKey) - .eq(SysRole::getStatus, UserConstants.ROLE_NORMAL) - .in(CollUtil.isNotEmpty(roleIds), SysRole::getRoleId, roleIds)); + return baseMapper.selectRoleList(new QueryWrapper() + .eq("r.status", UserConstants.ROLE_NORMAL) + .in(CollUtil.isNotEmpty(roleIds), "r.role_id", roleIds)); } /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java index a6ed7c05..4930cbcc 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java @@ -180,7 +180,7 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public List selectUserByIds(List userIds, Long deptId) { - return baseMapper.selectVoList(new LambdaQueryWrapper() + return baseMapper.selectUserList(new LambdaQueryWrapper() .select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName) .eq(SysUser::getStatus, UserConstants.USER_NORMAL) .eq(ObjectUtil.isNotNull(deptId), SysUser::getDeptId, deptId) diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 55c9b37c..48a42268 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -8,7 +8,7 @@ - select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, - u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark + select ${ew.getSqlSelect} from sys_user u - ${ew.getCustomSqlSegment} + ${ew.getCustomSqlSegment} + + +