From 890ef3c39d8e96727da3f0c3ea5341f582c1affd Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Wed, 17 Apr 2024 15:39:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=20=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Shentun.Peis.Domain/EntityHelper.cs | 43 +++++++++++++------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/Shentun.Peis.Domain/EntityHelper.cs b/src/Shentun.Peis.Domain/EntityHelper.cs index ec29b67..260725e 100644 --- a/src/Shentun.Peis.Domain/EntityHelper.cs +++ b/src/Shentun.Peis.Domain/EntityHelper.cs @@ -18,10 +18,10 @@ using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace Shentun.Peis { - public class EntityHelper + public class EntityHelper { - private static ICachedServiceProvider _serviceProvider; - + private static ICachedServiceProvider _serviceProvider; + /// /// 创建最大显示顺序 /// @@ -115,16 +115,19 @@ namespace Shentun.Peis { UptList = (await repository.GetListAsync(o => o.DisplayOrder < entity.DisplayOrder)).OrderByDescending(o => o.DisplayOrder).ToList(); ; - int indexnum = entity.DisplayOrder; //原有值 + if (UptList.Count > 0) + { + int indexnum = entity.DisplayOrder; //原有值 - entity.DisplayOrder = UptList[UptList.Count - 1].DisplayOrder; //修改当前排序值为最小 + entity.DisplayOrder = UptList[UptList.Count - 1].DisplayOrder; //修改当前排序值为最小 - //置底操作,往下一行开始,逐渐替换 - foreach (var item in UptList) - { - int dqnum = item.DisplayOrder; - item.DisplayOrder = indexnum; - indexnum = dqnum; + //置底操作,往下一行开始,逐渐替换 + foreach (var item in UptList) + { + int dqnum = item.DisplayOrder; + item.DisplayOrder = indexnum; + indexnum = dqnum; + } } } @@ -603,15 +606,15 @@ namespace Shentun.Peis /// /// /// - private static async Task GetUserNameFromCache( Guid? UserId) + private static async Task GetUserNameFromCache(Guid? UserId) { - - - var cacheService = _serviceProvider.GetRequiredService(); - var userName = await cacheService.GetUserNameAsync(UserId); - return userName; - - + + + var cacheService = _serviceProvider.GetRequiredService(); + var userName = await cacheService.GetUserNameAsync(UserId); + return userName; + + } @@ -643,7 +646,7 @@ namespace Shentun.Peis return ""; } } - + /// /// 获取顶级目录单位名称 单位 /// From 90e04b58473644af2302cc7631f963eee0366063 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Wed, 17 Apr 2024 15:55:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommonChars/CommonCharAppService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shentun.Peis.Application/CommonChars/CommonCharAppService.cs b/src/Shentun.Peis.Application/CommonChars/CommonCharAppService.cs index 8610c31..fd3f4c0 100644 --- a/src/Shentun.Peis.Application/CommonChars/CommonCharAppService.cs +++ b/src/Shentun.Peis.Application/CommonChars/CommonCharAppService.cs @@ -104,7 +104,7 @@ namespace Shentun.Peis.CommonChars CommonCharTypeName = s.CommonCharType.DisplayName, CreatorName = _cacheService.GetUserNameAsync(s.CreatorId).Result, LastModifierName = _cacheService.GetUserNameAsync(s.LastModifierId).Result - }).ToList(); + }).OrderBy(o => o.DisplayOrder).ToList(); return entListDto;