|
|
@@ -7,6 +7,7 @@ import com.usky.common.core.util.Convert;
|
|
|
import com.usky.common.core.util.StringUtils;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.redis.core.RedisHelper;
|
|
|
+import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.system.domain.SysConfig;
|
|
|
import com.usky.system.domain.constants.UserConstants;
|
|
|
import com.usky.system.mapper.SysConfigMapper;
|
|
|
@@ -65,17 +66,20 @@ public class SysConfigServiceImpl extends AbstractCrudService<SysConfigMapper, S
|
|
|
@Override
|
|
|
public String selectConfigByKey(String configKey)
|
|
|
{
|
|
|
- String configValue = Convert.toStr(redisHelper.get(getCacheKey(configKey)));
|
|
|
+ Integer tenantId = SecurityUtils.getTenantId();
|
|
|
+ String configKey1 = configKey+tenantId;
|
|
|
+ String configValue = Convert.toStr(redisHelper.get(getCacheKey(configKey1)));
|
|
|
if (StringUtils.isNotEmpty(configValue))
|
|
|
{
|
|
|
return configValue;
|
|
|
}
|
|
|
SysConfig config = new SysConfig();
|
|
|
config.setConfigKey(configKey);
|
|
|
+ config.setTenantId(tenantId);
|
|
|
SysConfig retConfig = configMapper.selectConfig(config);
|
|
|
if (Objects.nonNull(retConfig))
|
|
|
{
|
|
|
- redisHelper.set(getCacheKey(configKey), retConfig.getConfigValue());
|
|
|
+ redisHelper.set(getCacheKey(configKey1), retConfig.getConfigValue());
|
|
|
return retConfig.getConfigValue();
|
|
|
}
|
|
|
return StringUtils.EMPTY;
|
|
|
@@ -106,6 +110,7 @@ public class SysConfigServiceImpl extends AbstractCrudService<SysConfigMapper, S
|
|
|
@Override
|
|
|
public List<SysConfig> selectConfigList(SysConfig config)
|
|
|
{
|
|
|
+ config.setTenantId(SecurityUtils.getTenantId());
|
|
|
return configMapper.selectConfigList(config);
|
|
|
}
|
|
|
|
|
|
@@ -121,7 +126,7 @@ public class SysConfigServiceImpl extends AbstractCrudService<SysConfigMapper, S
|
|
|
int row = configMapper.insertConfig(config);
|
|
|
if (row > 0)
|
|
|
{
|
|
|
- redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
|
+ redisHelper.set(getCacheKey(config.getConfigKey()+SecurityUtils.getTenantId()), config.getConfigValue());
|
|
|
}
|
|
|
return row;
|
|
|
}
|
|
|
@@ -138,7 +143,7 @@ public class SysConfigServiceImpl extends AbstractCrudService<SysConfigMapper, S
|
|
|
int row = configMapper.updateConfig(config);
|
|
|
if (row > 0)
|
|
|
{
|
|
|
- redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
|
+ redisHelper.set(getCacheKey(config.getConfigKey()+SecurityUtils.getTenantId()), config.getConfigValue());
|
|
|
}
|
|
|
return row;
|
|
|
}
|
|
|
@@ -160,7 +165,7 @@ public class SysConfigServiceImpl extends AbstractCrudService<SysConfigMapper, S
|
|
|
throw new BusinessException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
|
|
}
|
|
|
configMapper.deleteConfigById(configId);
|
|
|
- redisHelper.delete(getCacheKey(config.getConfigKey()));
|
|
|
+ redisHelper.delete(getCacheKey(config.getConfigKey()+SecurityUtils.getTenantId()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -170,10 +175,12 @@ public class SysConfigServiceImpl extends AbstractCrudService<SysConfigMapper, S
|
|
|
@Override
|
|
|
public void loadingConfigCache()
|
|
|
{
|
|
|
- List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig());
|
|
|
+ SysConfig config1 = new SysConfig();
|
|
|
+ config1.setTenantId(SecurityUtils.getTenantId());
|
|
|
+ List<SysConfig> configsList = configMapper.selectConfigList(config1);
|
|
|
for (SysConfig config : configsList)
|
|
|
{
|
|
|
- redisHelper.set(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
|
|
+ redisHelper.set(getCacheKey(config.getConfigKey()+SecurityUtils.getTenantId()), config.getConfigValue());
|
|
|
}
|
|
|
}
|
|
|
|