refactor(system/user): 分页列表调整排除用户 ID 列表参数为 roleId,改为后端根据 roleId 查询

This commit is contained in:
2025-02-14 23:01:09 +08:00
parent 9eb0252d09
commit 144cfa27ce
2 changed files with 9 additions and 4 deletions

View File

@@ -74,8 +74,9 @@ public class UserQuery implements Serializable {
private List<Long> userIds; private List<Long> userIds;
/** /**
* 不包含的用户 ID 列表 * 角色 ID
* <p>用于在角色授权用户时,过滤掉已经分配给该角色的用户</p>
*/ */
@Schema(description = "不包含的用户 ID 列表", example = "[1,2]") @Schema(description = "角色 ID", example = "1")
private List<Long> excludeUserIds; private Long roleId;
} }

View File

@@ -488,7 +488,11 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
List<Date> createTimeList = query.getCreateTime(); List<Date> createTimeList = query.getCreateTime();
Long deptId = query.getDeptId(); Long deptId = query.getDeptId();
List<Long> userIdList = query.getUserIds(); List<Long> userIdList = query.getUserIds();
List<Long> excludeUserIdList = query.getExcludeUserIds(); // 获取排除用户 ID 列表
List<Long> excludeUserIdList = null;
if (null != query.getRoleId()) {
excludeUserIdList = userRoleService.listUserIdByRoleId(query.getRoleId());
}
return new QueryWrapper<UserDO>().and(StrUtil.isNotBlank(description), q -> q.like("t1.username", description) return new QueryWrapper<UserDO>().and(StrUtil.isNotBlank(description), q -> q.like("t1.username", description)
.or() .or()
.like("t1.nickname", description) .like("t1.nickname", description)