Commit 57b49dd5fa70237274f17d00e00534420c6a77c2
1 parent
9c0ed9c4
限制系统内置参数不允许删除
Showing
1 changed file
with
9 additions
and
0 deletions
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
| ... | ... | @@ -11,6 +11,7 @@ import com.ruoyi.common.constant.UserConstants; |
| 11 | 11 | import com.ruoyi.common.core.redis.RedisCache; |
| 12 | 12 | import com.ruoyi.common.core.text.Convert; |
| 13 | 13 | import com.ruoyi.common.enums.DataSourceType; |
| 14 | +import com.ruoyi.common.exception.CustomException; | |
| 14 | 15 | import com.ruoyi.common.utils.StringUtils; |
| 15 | 16 | import com.ruoyi.system.domain.SysConfig; |
| 16 | 17 | import com.ruoyi.system.mapper.SysConfigMapper; |
| ... | ... | @@ -138,6 +139,14 @@ public class SysConfigServiceImpl implements ISysConfigService |
| 138 | 139 | @Override |
| 139 | 140 | public int deleteConfigByIds(Long[] configIds) |
| 140 | 141 | { |
| 142 | + for (Long configId : configIds) | |
| 143 | + { | |
| 144 | + SysConfig config = selectConfigById(configId); | |
| 145 | + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) | |
| 146 | + { | |
| 147 | + throw new CustomException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); | |
| 148 | + } | |
| 149 | + } | |
| 141 | 150 | int count = configMapper.deleteConfigByIds(configIds); |
| 142 | 151 | if (count > 0) |
| 143 | 152 | { | ... | ... |