From bde9fd85641630fe232ba512aba26cf91cb0bc9f Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期二, 05 八月 2025 10:23:47 +0800 Subject: [PATCH] fix:bug --- FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs b/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs index 774ce2f..67bde63 100644 --- a/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs +++ b/FlexJobApi.User.Application/Menus/Commands/SaveMenuFieldCommandHandler.cs @@ -24,9 +24,12 @@ /// <inheritdoc/> public async Task<Guid> Handle(SaveMenuFieldCommand request, CancellationToken cancellationToken) { + var parent = await rep.FirstOrDefaultAsync(it => it.Id == request.ParentId); + if (parent == null) throw Oops.Oh(EnumErrorCodeType.s404, "涓婄骇鑿滃崟"); if (request.Id.HasValue) { var entity = await rep.FirstOrDefaultAsync(it => it.Id == it.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, "鑿滃崟缂栧彿"); @@ -36,6 +39,9 @@ else { var entity = new Menu(); + entity.Path = $"{parent.Path}{parent.Code}/"; + entity.Type = EnumMenuType.Field; + entity.VisitLevel = parent.VisitLevel; request.Adapt(entity); if (await CheckExist(entity)) throw Oops.Oh(EnumErrorCodeType.s405, "鑿滃崟缂栧彿"); await rep.InsertAsync(entity); -- Gitblit v1.9.1