限制系统内置参数不允许删除
This commit is contained in:
parent
9c0ed9c424
commit
57b49dd5fa
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue