sunpengfei
2025-08-06 bc6813b74e9a390eae2181d460c647445b7cb25a
FlexJobApi.User.Application/Menus/Commands/SaveMenuButtonCommandHandler.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.Button;
                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.Location == entity.Location
                    && it.Code == entity.Code