Sfoglia il codice sorgente

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

RuoYi 3 anni fa
parent
commit
f93fc98b4f

+ 1 - 1
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java

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

+ 1 - 2
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/file/FileUtils.java

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

+ 1 - 1
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java

@@ -13,7 +13,7 @@ public class SqlUtil
13
     /**
13
     /**
14
      * 定义常用的 sql关键字
14
      * 定义常用的 sql关键字
15
      */
15
      */
16
-    public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare ";
16
+    public static String SQL_REGEX = "and |extractvalue|updatexml|exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |or |+|user()";
17
 
17
 
18
     /**
18
     /**
19
      * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
19
      * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)

+ 8 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java

@@ -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 参数配置信息

+ 6 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java

@@ -115,6 +115,12 @@ public class SysConfigServiceImpl implements ISysConfigService
115
     @Override
115
     @Override
116
     public int updateConfig(SysConfig config)
116
     public int updateConfig(SysConfig config)
117
     {
117
     {
118
+        SysConfig temp = configMapper.selectConfigById(config.getConfigId());
119
+        if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey()))
120
+        {
121
+            redisService.deleteObject(getCacheKey(temp.getConfigKey()));
122
+        }
123
+
118
         int row = configMapper.updateConfig(config);
124
         int row = configMapper.updateConfig(config);
119
         if (row > 0)
125
         if (row > 0)
120
         {
126
         {

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -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