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

pull/298/head
RuoYi 2 years ago
parent c03a671de8
commit f93fc98b4f

@ -712,7 +712,7 @@ public class Convert
} }
if (value instanceof Double) if (value instanceof Double)
{ {
return new BigDecimal((Double) value); return BigDecimal.valueOf((Double) value);
} }
if (value instanceof Integer) if (value instanceof Integer)
{ {

@ -97,8 +97,7 @@ public class FileUtils
// 路径为文件且不为空则进行删除 // 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) if (file.isFile() && file.exists())
{ {
file.delete(); flag = file.delete();
flag = true;
} }
return flag; return flag;
} }

@ -13,7 +13,7 @@ public class SqlUtil
/** /**
* sql * sql
*/ */
public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare "; public static String SQL_REGEX = "and |extractvalue|updatexml|exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |or |+|user()";
/** /**
* 线 * 线

@ -18,6 +18,14 @@ public interface SysConfigMapper
*/ */
public SysConfig selectConfig(SysConfig config); public SysConfig selectConfig(SysConfig config);
/**
* ID
*
* @param configId ID
* @return
*/
public SysConfig selectConfigById(Long configId);
/** /**
* *
* *

@ -115,6 +115,12 @@ public class SysConfigServiceImpl implements ISysConfigService
@Override @Override
public int updateConfig(SysConfig config) public int updateConfig(SysConfig config)
{ {
SysConfig temp = configMapper.selectConfigById(config.getConfigId());
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
{
redisService.deleteObject(getCacheKey(temp.getConfigKey()));
}
int row = configMapper.updateConfig(config); int row = configMapper.updateConfig(config);
if (row > 0) if (row > 0)
{ {

@ -59,6 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult"> <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/> <include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1 where config_key = #{configKey} limit 1

Loading…
Cancel
Save