完善多租户的注释与代码

This commit is contained in:
YunaiV 2022-09-24 21:54:03 +08:00
parent b73cdd15b5
commit 034de50999
3 changed files with 5 additions and 4 deletions

View File

@ -12,7 +12,8 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
public enum DocumentEnum { public enum DocumentEnum {
REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"); REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"),
TENANT("https://doc.iocoder.cn", "SaaS 多租户文档");
private final String url; private final String url;
private final String memo; private final String memo;

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.framework.tenant.core.context; package cn.iocoder.yudao.framework.tenant.core.context;
import cn.iocoder.yudao.framework.common.enums.DocumentEnum;
import com.alibaba.ttl.TransmittableThreadLocal; import com.alibaba.ttl.TransmittableThreadLocal;
/** /**
@ -36,7 +37,8 @@ public class TenantContextHolder {
public static Long getRequiredTenantId() { public static Long getRequiredTenantId() {
Long tenantId = getTenantId(); Long tenantId = getTenantId();
if (tenantId == null) { if (tenantId == null) {
throw new NullPointerException("TenantContextHolder 不存在租户编号"); // TODO 芋艿增加文档链接 throw new NullPointerException("TenantContextHolder 不存在租户编号!可参考文档:"
+ DocumentEnum.TENANT.getUrl());
} }
return tenantId; return tenantId;
} }

View File

@ -28,8 +28,6 @@ import java.util.Objects;
* 2. 如果请求未带租户的编号检查是否是忽略的 URL否则也不允许访问 * 2. 如果请求未带租户的编号检查是否是忽略的 URL否则也不允许访问
* 3. 校验租户是合法例如说被禁用到期 * 3. 校验租户是合法例如说被禁用到期
* *
* 校验用户访问的租户是否是其所在的租户
*
* @author 芋道源码 * @author 芋道源码
*/ */
@Slf4j @Slf4j