作者 RuoYi

修改参数键名时移除前缓存配置

@@ -19,6 +19,14 @@ public interface SysConfigMapper @@ -19,6 +19,14 @@ public interface SysConfigMapper
19 public SysConfig selectConfig(SysConfig config); 19 public SysConfig selectConfig(SysConfig config);
20 20
21 /** 21 /**
  22 + * 通过ID查询配置
  23 + *
  24 + * @param configId 参数ID
  25 + * @return 参数配置信息
  26 + */
  27 + public SysConfig selectConfigById(Long configId);
  28 +
  29 + /**
22 * 查询参数配置列表 30 * 查询参数配置列表
23 * 31 *
24 * @param config 参数配置信息 32 * @param config 参数配置信息
@@ -134,6 +134,12 @@ public class SysConfigServiceImpl implements ISysConfigService @@ -134,6 +134,12 @@ public class SysConfigServiceImpl implements ISysConfigService
134 @Override 134 @Override
135 public int updateConfig(SysConfig config) 135 public int updateConfig(SysConfig config)
136 { 136 {
  137 + SysConfig temp = configMapper.selectConfigById(config.getConfigId());
  138 + if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
  139 + {
  140 + redisCache.deleteObject(getCacheKey(temp.getConfigKey()));
  141 + }
  142 +
137 int row = configMapper.updateConfig(config); 143 int row = configMapper.updateConfig(config);
138 if (row > 0) 144 if (row > 0)
139 { 145 {
@@ -59,6 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -59,6 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
59 </where> 59 </where>
60 </select> 60 </select>
61 61
  62 + <select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
  63 + <include refid="selectConfigVo"/>
  64 + where config_id = #{configId}
  65 + </select>
  66 +
62 <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult"> 67 <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
63 <include refid="selectConfigVo"/> 68 <include refid="selectConfigVo"/>
64 where config_key = #{configKey} limit 1 69 where config_key = #{configKey} limit 1