|
|
|
@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
|
|
|
|
|
package com.cloud.kicc.system.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import com.cloud.kicc.system.api.entity.Config; |
|
|
|
@ -25,15 +26,23 @@ public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> impleme
@@ -25,15 +26,23 @@ public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> impleme
|
|
|
|
|
|
|
|
|
|
private final CacheManager cacheManager; |
|
|
|
|
|
|
|
|
|
/** 获取配置参数缓存 */ |
|
|
|
|
@Override |
|
|
|
|
public String getValueByKey(String key) { |
|
|
|
|
public String getValueByKey(String key, String tenantId) { |
|
|
|
|
Cache cache = cacheManager.getCache(CacheConstants.CONFIG_PARAM); |
|
|
|
|
if (cache != null && cache.get(key) != null) { |
|
|
|
|
return (String) cache.get(key).get(); |
|
|
|
|
} else { |
|
|
|
|
Config config = baseMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getKey, key)); |
|
|
|
|
Config config = baseMapper.selectOne(new LambdaQueryWrapper<Config>() |
|
|
|
|
.eq(Config::getKey, key) |
|
|
|
|
.eq(StrUtil.isNotBlank(tenantId), Config::getTenantId, tenantId) |
|
|
|
|
); |
|
|
|
|
return config.getValue(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getValueByKey(String key) { |
|
|
|
|
return getValueByKey(key, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|