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)