| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | if (StrUtil.equals(UserConstants.YES, config.getConfigType())) { |
| | | throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | configMapper.deleteConfigById(configId); |
| | | configMapper.deleteById(configId); |
| | | redisCache.deleteObject(getCacheKey(config.getConfigKey())); |
| | | } |
| | | } |
| | |
| | | * 加载参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingConfigCache() |
| | | { |
| | | List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) |
| | | { |
| | | public void loadingConfigCache() { |
| | | List<SysConfig> configsList = selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) { |
| | | redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | } |
| | |
| | | * 清空参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() |
| | | { |
| | | public void clearConfigCache() { |
| | | Collection<String> keys = redisCache.keys(Constants.SYS_CONFIG_KEY + "*"); |
| | | redisCache.deleteObject(keys); |
| | | } |
| | |
| | | * 重置参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetConfigCache() |
| | | { |
| | | public void resetConfigCache() { |
| | | clearConfigCache(); |
| | | loadingConfigCache(); |
| | | } |