update 去除菜单唯一编码必填

This commit is contained in:
2021-06-04 11:05:38 +08:00
parent 7769c4bb43
commit 87932db039
2 changed files with 12 additions and 7 deletions

View File

@@ -232,9 +232,12 @@ namespace Ewide.Core.Service
[HttpPost("/sysMenu/add")]
public async Task AddMenu(AddMenuInput input)
{
var isExist = await _sysMenuRep.DetachedEntities.AnyAsync(u => u.Code == input.Code); // u.Name == input.Name
if (isExist)
throw Oops.Oh(ErrorCode.D4000);
if (!string.IsNullOrEmpty(input.Code))
{
var isExist = await _sysMenuRep.DetachedEntities.AnyAsync(u => u.Code == input.Code); // u.Name == input.Name
if (isExist)
throw Oops.Oh(ErrorCode.D4000);
}
// 校验参数
CheckMenuParam(input);
@@ -285,9 +288,12 @@ namespace Ewide.Core.Service
if (input.Id == input.Pid)
throw Oops.Oh(ErrorCode.D4006);
var isExist = await _sysMenuRep.DetachedEntities.AnyAsync(u => u.Code == input.Code && u.Id != input.Id); // u.Name == input.Name
if (isExist)
throw Oops.Oh(ErrorCode.D4000);
if (!string.IsNullOrEmpty(input.Code))
{
var isExist = await _sysMenuRep.DetachedEntities.AnyAsync(u => u.Code == input.Code && u.Id != input.Id); // u.Name == input.Name
if (isExist)
throw Oops.Oh(ErrorCode.D4000);
}
// 校验参数
CheckMenuParam(input);