Compare commits

..

2 Commits

Author SHA1 Message Date
f7e3cad931 feat(system): 支持分页查询租户时根据all参数控制范围
- 新增TenantParam中的all字段用于控制是否查询全部租户
- page接口根据all参数判断是否自动设置当前登录用户userId作为过滤条件
- 保持mask参数逻辑不变,支持脱敏控制
- 改进分页查询功能,增强查询灵活性和权限控制
2026-04-27 09:32:36 +08:00
6a48299e12 fix(system): 修复超级管理员用户名设置错误
- 将超级管理员用户名从随机UUID改为固定的"superAdmin"
- 确保超级管理员账户标识一致性
- 便于后续权限管理和系统维护
2026-04-27 09:25:36 +08:00
3 changed files with 13 additions and 4 deletions

View File

@@ -53,6 +53,15 @@ public class TenantController extends BaseController {
@Operation(summary = "分页查询租户") @Operation(summary = "分页查询租户")
@GetMapping("/page") @GetMapping("/page")
public ApiResult<PageResult<Tenant>> page(TenantParam param) { public ApiResult<PageResult<Tenant>> page(TenantParam param) {
// 如果传了 all=true查询全部租户否则自动用当前登录用户的 userId
if (param.getAll() == null || !param.getAll()) {
if (param.getUserId() == null) {
final User loginUser = getLoginUser();
if (loginUser != null && loginUser.getUserId() != null) {
param.setUserId(loginUser.getUserId());
}
}
}
PageResult<Tenant> result = tenantService.pageRel(param); PageResult<Tenant> result = tenantService.pageRel(param);
// 如果传入 mask=false设置不脱敏 // 如果传入 mask=false设置不脱敏
if (param.getMask() != null && !param.getMask()) { if (param.getMask() != null && !param.getMask()) {

View File

@@ -1,13 +1,10 @@
package com.gxwebsoft.common.system.param; package com.gxwebsoft.common.system.param;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField; import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType; import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam; import com.gxwebsoft.common.core.web.BaseParam;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -56,4 +53,7 @@ public class TenantParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Boolean mask; private Boolean mask;
@Schema(description = "查询全部租户true时忽略userId条件")
private Boolean all;
} }

View File

@@ -105,7 +105,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
// 添加超级管理员 // 添加超级管理员
User superAdmin = new User(); User superAdmin = new User();
superAdmin.setUsername(CommonUtil.randomUUID16()); // 使用随机用户名 superAdmin.setUsername("superAdmin");
superAdmin.setNickname(company.getShortName()); superAdmin.setNickname(company.getShortName());
superAdmin.setPhone(company.getPhone()); superAdmin.setPhone(company.getPhone());
superAdmin.setEmail(company.getEmail()); superAdmin.setEmail(company.getEmail());