diff --git a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java index 70770f27..b510ad23 100644 --- a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java +++ b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/PlusTenantLineHandler.java @@ -2,6 +2,7 @@ package org.dromara.common.tenant.handle; import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; +import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.tenant.helper.TenantHelper; @@ -18,6 +19,7 @@ import java.util.List; * * @author Lion Li */ +@Slf4j @AllArgsConstructor public class PlusTenantLineHandler implements TenantLineHandler { @@ -27,6 +29,7 @@ public class PlusTenantLineHandler implements TenantLineHandler { public Expression getTenantId() { String tenantId = LoginHelper.getTenantId(); if (StringUtils.isBlank(tenantId)) { + log.error("无法获取有效的租户id -> Null"); return new NullValue(); } String dynamicTenantId = TenantHelper.getDynamic(); diff --git a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/TenantKeyPrefixHandler.java b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/TenantKeyPrefixHandler.java index c9c2f952..4b313436 100644 --- a/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/TenantKeyPrefixHandler.java +++ b/ruoyi-common/ruoyi-common-tenant/src/main/java/org/dromara/common/tenant/handle/TenantKeyPrefixHandler.java @@ -1,5 +1,6 @@ package org.dromara.common.tenant.handle; +import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.constant.GlobalConstants; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.redis.handler.KeyPrefixHandler; @@ -10,6 +11,7 @@ import org.dromara.common.tenant.helper.TenantHelper; * * @author Lion Li */ +@Slf4j public class TenantKeyPrefixHandler extends KeyPrefixHandler { public TenantKeyPrefixHandler(String keyPrefix) { @@ -28,6 +30,9 @@ public class TenantKeyPrefixHandler extends KeyPrefixHandler { return super.map(name); } String tenantId = TenantHelper.getTenantId(); + if (StringUtils.isBlank(tenantId)) { + log.error("无法获取有效的租户id -> Null"); + } if (StringUtils.startsWith(name, tenantId)) { // 如果存在则直接返回 return super.map(name); @@ -48,6 +53,9 @@ public class TenantKeyPrefixHandler extends KeyPrefixHandler { return super.unmap(name); } String tenantId = TenantHelper.getTenantId(); + if (StringUtils.isBlank(tenantId)) { + log.error("无法获取有效的租户id -> Null"); + } if (StringUtils.startsWith(unmap, tenantId)) { // 如果存在则删除 return unmap.substring((tenantId + ":").length());