|
|
@@ -85,7 +85,12 @@ public class SysConfigServiceImpl implements SysConfigService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public SysConfig getByKey(String key,TenantEntity tenantEntity) { |
|
|
|
SysConfig config = RedisCacheUtils.getCacheObject(baseRedisTemplate, String.format(cache_prex, tenantEntity.getTenantId(),key), SysConfig.class); |
|
|
|
|
|
|
|
String cachekey = String.format(cache_prex,"0",key); |
|
|
|
if (null != tenantEntity) { |
|
|
|
cachekey = String.format(cache_prex, tenantEntity.getTenantId(),key); |
|
|
|
} |
|
|
|
SysConfig config = RedisCacheUtils.getCacheObject(baseRedisTemplate, cachekey, SysConfig.class); |
|
|
|
if (null == config) { |
|
|
|
SysConfig cq = new SysConfig(); |
|
|
|
cq.setConfigItemKey(key); |
|
|
@@ -93,11 +98,13 @@ public class SysConfigServiceImpl implements SysConfigService { |
|
|
|
if (null != config ) { |
|
|
|
SysConfigValue cvq = new SysConfigValue(); |
|
|
|
cvq.setConfigItemId(config.getId()); |
|
|
|
cvq.updateTenantInfo(tenantEntity); |
|
|
|
if (null != tenantEntity) { |
|
|
|
cvq.updateTenantInfo(tenantEntity); |
|
|
|
} |
|
|
|
SysConfigValue configValue = sysConfigValueMapper.findByItemId(cvq); |
|
|
|
if (null != configValue) { |
|
|
|
config.setConfigItemValue(configValue.getConfigItemValue()); |
|
|
|
RedisCacheUtils.cache(baseRedisTemplate, String.format(cache_prex, tenantEntity.getTenantId(),key), config, 3600*24*3); |
|
|
|
RedisCacheUtils.cache(baseRedisTemplate, cachekey, config, 3600*24*3); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -110,7 +117,9 @@ public class SysConfigServiceImpl implements SysConfigService { |
|
|
|
|
|
|
|
SysConfigValue cvq = new SysConfigValue(); |
|
|
|
cvq.setConfigItemId(config.getId()); |
|
|
|
cvq.updateTenantInfo(tenantEntity); |
|
|
|
if (null != tenantEntity) { |
|
|
|
cvq.updateTenantInfo(tenantEntity); |
|
|
|
} |
|
|
|
SysConfigValue configValue = sysConfigValueMapper.findByItemId(cvq); |
|
|
|
if (null != configValue) { |
|
|
|
configValue.setConfigItemValue(value); |
|
|
@@ -121,12 +130,18 @@ public class SysConfigServiceImpl implements SysConfigService { |
|
|
|
configValue = new SysConfigValue(); |
|
|
|
configValue.setConfigItemId(config.getId()); |
|
|
|
configValue.setId(idWorker.nextId()); |
|
|
|
configValue.updateTenantInfo(tenantEntity); |
|
|
|
if (null != tenantEntity) { |
|
|
|
configValue.updateTenantInfo(tenantEntity); |
|
|
|
} |
|
|
|
configValue.setConfigItemValue(value); |
|
|
|
configValue.setCreateDate(new Date()); |
|
|
|
sysConfigValueMapper.insert(configValue); |
|
|
|
} |
|
|
|
RedisCacheUtils.removeCache(baseRedisTemplate, String.format(cache_prex, tenantEntity.getTenantId(),config.getConfigItemKey())); |
|
|
|
String cachekey = String.format(cache_prex,"0",config.getConfigItemKey()); |
|
|
|
if (null != tenantEntity) { |
|
|
|
cachekey = String.format(cache_prex, tenantEntity.getTenantId(),config.getConfigItemKey()); |
|
|
|
} |
|
|
|
RedisCacheUtils.removeCache(baseRedisTemplate,cachekey); |
|
|
|
} |
|
|
|
|
|
|
|
} |