From 8940cd8dc034514de54fefdb809c7819e80dce3d Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 13 Dec 2022 19:36:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0=E9=94=AE?= =?UTF-8?q?=E5=90=8D=E6=97=B6=E7=A7=BB=E9=99=A4=E5=89=8D=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/project/system/mapper/SysConfigMapper.java | 8 ++++++++ .../project/system/service/impl/SysConfigServiceImpl.java | 6 ++++++ src/main/resources/mybatis/system/SysConfigMapper.xml | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/src/main/java/com/ruoyi/project/system/mapper/SysConfigMapper.java b/src/main/java/com/ruoyi/project/system/mapper/SysConfigMapper.java index eea48d6..4853aee 100644 --- a/src/main/java/com/ruoyi/project/system/mapper/SysConfigMapper.java +++ b/src/main/java/com/ruoyi/project/system/mapper/SysConfigMapper.java @@ -18,6 +18,14 @@ public interface SysConfigMapper */ public SysConfig selectConfig(SysConfig config); + /** + * 通过ID查询配置 + * + * @param configId 参数ID + * @return 参数配置信息 + */ + public SysConfig selectConfigById(Long configId); + /** * 查询参数配置列表 * diff --git a/src/main/java/com/ruoyi/project/system/service/impl/SysConfigServiceImpl.java b/src/main/java/com/ruoyi/project/system/service/impl/SysConfigServiceImpl.java index 2c217d2..9aa2a3c 100644 --- a/src/main/java/com/ruoyi/project/system/service/impl/SysConfigServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/service/impl/SysConfigServiceImpl.java @@ -131,6 +131,12 @@ public class SysConfigServiceImpl implements ISysConfigService @Override public int updateConfig(SysConfig config) { + SysConfig temp = configMapper.selectConfigById(config.getConfigId()); + if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) + { + redisCache.deleteObject(getCacheKey(temp.getConfigKey())); + } + int row = configMapper.updateConfig(config); if (row > 0) { diff --git a/src/main/resources/mybatis/system/SysConfigMapper.xml b/src/main/resources/mybatis/system/SysConfigMapper.xml index b4255ea..793e3bc 100644 --- a/src/main/resources/mybatis/system/SysConfigMapper.xml +++ b/src/main/resources/mybatis/system/SysConfigMapper.xml @@ -59,6 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + +