完善“ruoyi-common-tenant“模块
This commit is contained in:
parent
617cf85209
commit
6e9d42088b
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.common.core.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author LionLi
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TenantStatus {
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
OK("0", "正常"),
|
||||
/**
|
||||
* 停用
|
||||
*/
|
||||
DISABLE("1", "停用"),
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETED("2", "删除");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
}
|
@ -7,7 +7,7 @@ import com.ruoyi.common.tenant.helper.TenantHelper;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* 自定义租户处理器
|
||||
* 自定义租户工厂
|
||||
*
|
||||
* @author 数据小王子
|
||||
*/
|
||||
|
@ -109,8 +109,13 @@ public class TenantHelper {
|
||||
if (ObjectUtil.isNotNull(tenantId)) {
|
||||
return tenantId;
|
||||
}
|
||||
tenantId = RedisUtils.getCacheObject(cacheKey);
|
||||
SaHolder.getStorage().set(cacheKey, tenantId);
|
||||
System.out.println("####################:RedisUtils.getCacheObject("+cacheKey+")="+RedisUtils.getCacheObject(cacheKey));
|
||||
if (ObjectUtil.isNotNull(RedisUtils.getCacheObject(cacheKey))) {
|
||||
tenantId = Long.valueOf(RedisUtils.getCacheObject(cacheKey));
|
||||
}
|
||||
if (ObjectUtil.isNotNull(tenantId)) {
|
||||
SaHolder.getStorage().set(cacheKey, tenantId);
|
||||
}
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ public class TenantSpringCacheManager extends FlexSpringCacheManager {
|
||||
if (StringUtils.contains(name, GlobalConstants.GLOBAL_REDIS_KEY)) {
|
||||
return super.getCache(name);
|
||||
}
|
||||
String tenantId = TenantHelper.getTenantId();
|
||||
if (StringUtils.startsWith(name, tenantId)) {
|
||||
Long tenantId = TenantHelper.getTenantId();
|
||||
if (StringUtils.startsWith(name, tenantId + "")) {
|
||||
// 如果存在则直接返回
|
||||
return super.getCache(name);
|
||||
}
|
||||
|
@ -19,9 +19,4 @@ public class TenantProperties {
|
||||
*/
|
||||
private Boolean enable;
|
||||
|
||||
/**
|
||||
* 排除表
|
||||
*/
|
||||
private List<String> excludes;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user