mirror of https://gitee.com/stylefeng/roses
【8.0】【tenant】更新租户参数未传递为空的判断,返回默认租户id
parent
c325e061ba
commit
0c9aafcded
|
@ -1,5 +1,6 @@
|
|||
package cn.stylefeng.roses.kernel.auth.auth;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.stylefeng.roses.kernel.auth.api.TenantCodeGetApi;
|
||||
import cn.stylefeng.roses.kernel.sys.api.expander.TenantConfigExpander;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -22,10 +23,21 @@ public class DefaultTenantCodeProvider implements TenantCodeGetApi {
|
|||
|
||||
@Override
|
||||
public Long getTenantIdByCode(String tenantCode) {
|
||||
|
||||
Long defaultRootTenantId = TenantConfigExpander.getDefaultRootTenantId();
|
||||
|
||||
// 如果租户编码为空,那么返回默认的租户id
|
||||
if (ObjectUtil.isEmpty(tenantCode)) {
|
||||
return defaultRootTenantId;
|
||||
}
|
||||
|
||||
// 判断请求的租户编码是否是默认的租户id一致,字符串比较,如果一致则返回默认的租户id
|
||||
if (defaultRootTenantId.toString().equals(tenantCode)) {
|
||||
return defaultRootTenantId;
|
||||
} else {
|
||||
}
|
||||
|
||||
// 如果不一致,则返回不存在的租户id
|
||||
else {
|
||||
log.warn("当前系统为单租户系统,不支持多租户功能!");
|
||||
return DEFAULT_NONE_TENANT_ID;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue