add
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
package com.qiaoba.common.base.code;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 租户错误code
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023/6/12 13:33
|
||||
*/
|
||||
@Getter
|
||||
public enum TenantErrorCode {
|
||||
|
||||
/**
|
||||
* 未找到
|
||||
*/
|
||||
NOT_FIND(5010, "未找到租户信息"),
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
DISABLE(5011, "租户被禁用"),
|
||||
|
||||
/**
|
||||
* 过期
|
||||
*/
|
||||
EXPIRE(5012, "租户已过期");
|
||||
|
||||
private final Integer code;
|
||||
private final String msg;
|
||||
|
||||
TenantErrorCode(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.qiaoba.common.base.code;
|
||||
|
||||
/**
|
||||
* 用户错误code
|
||||
*
|
||||
* @author ailanyin
|
||||
* @version 1.0
|
||||
* @since 2023/6/12 13:34
|
||||
*/
|
||||
public enum UserErrorCode {
|
||||
|
||||
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
package com.qiaoba.common.redis.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.qiaoba.common.base.constants.BaseConstant;
|
||||
import com.qiaoba.common.base.constants.TenantConstant;
|
||||
import com.qiaoba.common.base.context.BaseContext;
|
||||
import com.qiaoba.common.base.entity.BasePage;
|
||||
import com.qiaoba.common.redis.service.RedisService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -23,6 +25,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class RedisServiceImpl implements RedisService {
|
||||
|
||||
private final RedisTemplate<String, Object> redisTemplate;
|
||||
@ -255,6 +258,7 @@ public class RedisServiceImpl implements RedisService {
|
||||
public String addTenantPrefix(String key) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(TenantConstant.TENANT_KEY_PREFIX).append(BaseContext.getTenantId()).append(BaseConstant.COLON_JOIN_STR).append(key);
|
||||
log.debug(StrUtil.format("拼接后的RedisKey: {}", sb.toString()));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@ -262,6 +266,7 @@ public class RedisServiceImpl implements RedisService {
|
||||
public String removeTenantPrefix(String key) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(TenantConstant.TENANT_KEY_PREFIX).append(BaseContext.getTenantId()).append(BaseConstant.COLON_JOIN_STR);
|
||||
log.debug(StrUtil.format("去除拼接后的RedisKey: {}", key.replace(sb.toString(), "")));
|
||||
return key.replace(sb.toString(), "");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user