feat(user): 添加显示所有用户功能

- 在 UserSearchQO 中新增 showAll 字段,默认值为 true
- 修改 UserControllerService 中的权限判断逻辑,增加对 showAll 参数的支持
- 非超级管理员用户可通过设置 showAll 控制是否显示所有用户数据
This commit is contained in:
曹鹏飞 2026-06-14 10:42:34 +08:00
parent be4ac6d479
commit 36ad7c0bfa
2 changed files with 6 additions and 1 deletions

View File

@ -186,7 +186,7 @@ public class UserControllerService {
if (Objects.nonNull(request.getDeptId())) {
request.setDeptIds(deptService.getWithChildren(request.getDeptId()));
}
if (!UserUtil.getRoles().contains(Constant.SUPER_ADMIN)) {
if (!request.getShowAll() || !UserUtil.getRoles().contains(Constant.SUPER_ADMIN)) {
request.setCreateById(UserUtil.getUserId());
}
IPage<UserVO> pu = uService.search(request);

View File

@ -31,4 +31,9 @@ public class UserSearchQO extends SearchBaseQO {
@JsonIgnore
private Long createById;
/**
* 是否显示所有用户
*/
private Boolean showAll = true;
}