Compare commits
4 Commits
6804a0a824
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f7e3cad931 | |||
| 6a48299e12 | |||
| ed9d500e5d | |||
| 64e9674d0e |
@@ -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()) {
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ public class User implements UserDetails {
|
|||||||
private Integer isOrganizationAdmin;
|
private Integer isOrganizationAdmin;
|
||||||
|
|
||||||
@Schema(description = "是否超级管理员")
|
@Schema(description = "是否超级管理员")
|
||||||
@TableField(exist = false)
|
|
||||||
private Boolean isSuperAdmin;
|
private Boolean isSuperAdmin;
|
||||||
|
|
||||||
@Schema(description = "租户管理员ID")
|
@Schema(description = "租户管理员ID")
|
||||||
|
|||||||
@@ -8,11 +8,7 @@
|
|||||||
u.phone,u.username
|
u.phone,u.username
|
||||||
FROM sys_tenant a
|
FROM sys_tenant a
|
||||||
LEFT JOIN sys_company b ON a.tenant_id = b.tenant_id
|
LEFT JOIN sys_company b ON a.tenant_id = b.tenant_id
|
||||||
LEFT JOIN sys_user u ON u.tenant_id = a.tenant_id AND u.is_admin = 1
|
LEFT JOIN gxwebsoft_core.sys_user u ON u.tenant_id = a.tenant_id AND u.is_super_admin = 1 AND u.deleted = 0
|
||||||
AND u.user_id = (
|
|
||||||
SELECT MIN(user_id) FROM sys_user
|
|
||||||
WHERE tenant_id = a.tenant_id AND is_admin = 1 AND deleted = 0
|
|
||||||
)
|
|
||||||
<where>
|
<where>
|
||||||
<if test="param.tenantId != null">
|
<if test="param.tenantId != null">
|
||||||
AND a.tenant_id = #{param.tenantId}
|
AND a.tenant_id = #{param.tenantId}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
Reference in New Issue
Block a user