From 35f8665dac111172415625d226c06234a198c176 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 15 Sep 2020 17:12:51 +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-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 8945cb7..0c6e9c5 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.UserConstants; +import com.ruoyi.common.core.exception.CustomException; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.redis.service.RedisService; @@ -135,6 +136,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) {