mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-29 14:57:10 +08:00
fix: 字典编码、存储编码及类型、菜单类型不允许修改
This commit is contained in:
@@ -55,12 +55,8 @@ public class DictServiceImpl extends BaseServiceImpl<DictMapper, DictDO, DictRes
|
|||||||
protected void beforeUpdate(DictReq req, Long id) {
|
protected void beforeUpdate(DictReq req, Long id) {
|
||||||
String name = req.getName();
|
String name = req.getName();
|
||||||
CheckUtils.throwIf(this.isNameExists(name, id), "修改失败,[{}] 已存在", name);
|
CheckUtils.throwIf(this.isNameExists(name, id), "修改失败,[{}] 已存在", name);
|
||||||
String code = req.getCode();
|
|
||||||
CheckUtils.throwIf(this.isCodeExists(code, id), "修改失败,[{}] 已存在", code);
|
|
||||||
DictDO oldDict = super.getById(id);
|
DictDO oldDict = super.getById(id);
|
||||||
if (Boolean.TRUE.equals(oldDict.getIsSystem())) {
|
CheckUtils.throwIfNotEqual(req.getCode(), oldDict.getCode(), "不允许修改字典编码");
|
||||||
CheckUtils.throwIfNotEqual(req.getCode(), oldDict.getCode(), "[{}] 是系统内置字典,不允许修改字典编码", oldDict.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ public class MenuServiceImpl extends BaseServiceImpl<MenuMapper, MenuDO, MenuRes
|
|||||||
public void update(MenuReq req, Long id) {
|
public void update(MenuReq req, Long id) {
|
||||||
String title = req.getTitle();
|
String title = req.getTitle();
|
||||||
CheckUtils.throwIf(this.isNameExists(title, req.getParentId(), id), "修改失败,[{}] 已存在", title);
|
CheckUtils.throwIf(this.isNameExists(title, req.getParentId(), id), "修改失败,[{}] 已存在", title);
|
||||||
|
MenuDO oldMenu = super.getById(id);
|
||||||
|
CheckUtils.throwIfNotEqual(req.getType(), oldMenu.getType(), "不允许修改菜单类型");
|
||||||
super.update(req, id);
|
super.update(req, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,10 +74,10 @@ public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void beforeUpdate(StorageReq req, Long id) {
|
protected void beforeUpdate(StorageReq req, Long id) {
|
||||||
String code = req.getCode();
|
|
||||||
CheckUtils.throwIf(this.isCodeExists(code, id), "修改失败,[{}] 已存在", code);
|
|
||||||
DisEnableStatusEnum newStatus = req.getStatus();
|
|
||||||
StorageDO oldStorage = super.getById(id);
|
StorageDO oldStorage = super.getById(id);
|
||||||
|
CheckUtils.throwIfNotEqual(req.getCode(), oldStorage.getCode(), "不允许修改存储编码");
|
||||||
|
CheckUtils.throwIfNotEqual(req.getType(), oldStorage.getType(), "不允许修改存储类型");
|
||||||
|
DisEnableStatusEnum newStatus = req.getStatus();
|
||||||
CheckUtils.throwIf(Boolean.TRUE.equals(oldStorage.getIsDefault()) && DisEnableStatusEnum.DISABLE
|
CheckUtils.throwIf(Boolean.TRUE.equals(oldStorage.getIsDefault()) && DisEnableStatusEnum.DISABLE
|
||||||
.equals(newStatus), "[{}] 是默认存储,不允许禁用", oldStorage.getName());
|
.equals(newStatus), "[{}] 是默认存储,不允许禁用", oldStorage.getName());
|
||||||
this.decodeSecretKey(req, oldStorage);
|
this.decodeSecretKey(req, oldStorage);
|
||||||
|
|||||||
Reference in New Issue
Block a user