From cc58e39a44e156e5fceefdadb54fc70bf0c68971 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 9 Apr 2024 15:54:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=B7=AF=E7=94=B1=E5=85=85=E5=80=BC?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs b/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs index dbb84f98..e7ee9ddf 100644 --- a/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs +++ b/Src/Dlhis.Sys/Menu/Services/Implements/MenuService.cs @@ -1,14 +1,11 @@ -using System.ComponentModel.DataAnnotations; -using Dlhis.Entity.Sys.Entities; +using Dlhis.Entity.Sys.Entities; using Dlhis.Entity.Sys.Enums; using Dlhis.Sys.Identity.Services; using Dlhis.Sys.Menu.Request; using Dlhis.Sys.Menu.Response; using Kurisu.AspNetCore.Scope; using Kurisu.AspNetCore.Utils.Extensions; -using Kurisu.Core.Result; using Kurisu.Core.User.Abstractions; -using Kurisu.SqlSugar.Attributes; using Kurisu.SqlSugar.Services; using Mapster; @@ -190,11 +187,12 @@ public class MenuService : IMenuService public async Task ResetAsync(List request) { - var menus = await _dbContext.Queryable().Where(x => x.Platform == PlatformEnumType.PCAdmin).ToListAsync(); - await _dbContext.Client.Deleteable(menus).ExecuteCommandAsync(); + var currentMenus = await _dbContext.Queryable().Where(x => x.Platform == PlatformEnumType.PCAdmin).ToListAsync(); + await _dbContext.Client.Deleteable(currentMenus).ExecuteCommandAsync(); foreach (var item in request) { + item.Sequence = currentMenus.FirstOrDefault(x => x.Code == item.Code)?.Sequence ?? item.Sequence; var code = await SaveMenuAsync(item); if (item.Items?.Any() == true) { @@ -208,6 +206,7 @@ public class MenuService : IMenuService { foreach (var item in menus) { + item.Sequence = currentMenus.FirstOrDefault(x => x.Code == item.Code)?.Sequence ?? item.Sequence; var code = await SaveMenuAsync(item); if (item.Items?.Any() == true)