From 74f7cb1840db9dc031ca1aa3d5db3de04df8b612 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期二, 05 八月 2025 14:54:18 +0800 Subject: [PATCH] pref:优化 --- FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs b/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs index 67bde63..2bda2f5 100644 --- a/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs +++ b/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs @@ -28,11 +28,11 @@ if (parent == null) throw Oops.Oh(EnumErrorCodeType.s404, "涓婄骇鑿滃崟"); if (request.Id.HasValue) { - var entity = await rep.FirstOrDefaultAsync(it => it.Id == it.Id); + var entity = await rep.FirstOrDefaultAsync(it => it.Id == request.Id); if (entity == null) throw Oops.Oh(EnumErrorCodeType.s404, "璇ヨ彍鍗�"); if (entity.ParentId != request.ParentId) throw Oops.Oh(EnumErrorCodeType.s410, "涓婄骇Id"); request.Adapt(entity); - if (await CheckExist(entity)) throw Oops.Oh(EnumErrorCodeType.s405, "鑿滃崟缂栧彿"); + if (await CheckExist(entity)) throw Oops.Oh(EnumErrorCodeType.s406, "鑿滃崟缂栧彿"); await rep.UpdateAsync(entity); return entity.Id; } @@ -43,7 +43,7 @@ entity.Type = EnumMenuType.Field; entity.VisitLevel = parent.VisitLevel; request.Adapt(entity); - if (await CheckExist(entity)) throw Oops.Oh(EnumErrorCodeType.s405, "鑿滃崟缂栧彿"); + if (await CheckExist(entity)) throw Oops.Oh(EnumErrorCodeType.s406, "鑿滃崟缂栧彿"); await rep.InsertAsync(entity); return entity.Id; } @@ -59,6 +59,7 @@ return await rep.AsQueryable().AsNoTracking() .AnyAsync(it => it.ParentId == entity.ParentId + && it.Type == entity.Type && it.Group == entity.Group && it.Code == entity.Code && it.Id != entity.Id); -- Gitblit v1.9.1