From 57b49dd5fa70237274f17d00e00534420c6a77c2 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 15 Sep 2020 15:51:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E7=B3=BB=E7=BB=9F=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E5=8F=82=E6=95=B0=E4=B8=8D=E5=85=81=E8=AE=B8=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/system/service/impl/SysConfigServiceImpl.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 1c113fa..f1e2f29 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -11,6 +11,7 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.common.exception.CustomException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.mapper.SysConfigMapper; @@ -138,6 +139,14 @@ public class SysConfigServiceImpl implements ISysConfigService @Override public int deleteConfigByIds(Long[] configIds) { + for (Long configId : configIds) + { + SysConfig config = selectConfigById(configId); + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) + { + throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); + } + } int count = configMapper.deleteConfigByIds(configIds); if (count > 0) {