From e3a8a94e1e1b6ca86eba27e72d30f3adc82c4d77 Mon Sep 17 00:00:00 2001 From: moyongzhen <2534173414@qq.com> Date: Fri, 1 Mar 2024 16:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A8=E8=BF=B9=E6=A0=87=E8=AE=B0=E4=B9=9F?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackFlags/GetTrackFlagListDto.cs | 5 +++++ .../Dtos/TrackFlags/GetPageTrackFlagVO.cs | 5 +++++ .../Repositories/TrackContentRepository.cs | 1 + .../Repositories/TrackFlagRepository.cs | 5 +++-- .../Repositories/TrackStatusRepository.cs | 3 ++- .../Repositories/TrackTemplateRepository.cs | 17 +++++++++-------- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs index 1ca2c4df..4280f8d2 100644 --- a/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs +++ b/src/SJZY.Track.Application.Contract/Dtos/TrackFlags/GetTrackFlagListDto.cs @@ -55,6 +55,11 @@ /// public int SubSystemId { get; set; } + /// + /// 选中的轨迹标记id + /// + public List? SelectIds { get; set; } + ///// ///// 关键字 ///// diff --git a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs index 20f7c40f..d3699b75 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackFlags/GetPageTrackFlagVO.cs @@ -13,6 +13,11 @@ namespace SJZY.Track.Domain.Dtos.TrackFlags /// public int SubSystemId { get; set; } + /// + /// 选中的轨迹标记id + /// + public List? SelectIds { get; set; } + ///// ///// 关键字 ///// diff --git a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs index bbde4d6f..a7bb1b6a 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackContentRepository.cs @@ -62,6 +62,7 @@ public class TrackContentRepository : BasicRepository, ITrac (a, b, c, d, e, f) => a.Code.Contains(input.Keywords) || a.Content.Contains(input.Keywords) || a.EnContent.Contains(input.Keywords) ) + .OrderByDescending((a, b, c, d, e, f) => a.CreateTime) .Select((a, b, c, d, e, f) => new GetTrackContentListVO { Id = a.Id, diff --git a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs index 2a2a4ba6..2a710641 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackFlagRepository.cs @@ -46,6 +46,8 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR .LeftJoin((a, b, c) => a.CreateUserId == c.Id) .LeftJoin((a, b, c, d) => a.UpdateUserId == d.Id) .WhereIF(input.SubSystemId > 0, (a, b, c, d) => a.SubSystemId == input.SubSystemId) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => a.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b, c, d) => new GetTrackFlagListVO { Id = a.Id, @@ -56,8 +58,7 @@ public class TrackFlagRepository : BasicRepository, ITrackFlagR CreateTime = a.CreateTime, CreateUser = c.Name, UpdateTime = a.UpdateTime, - UpdateUser = d.Name, - + UpdateUser = d.Name }) .ToPagedListAsync(input.PageIndex, input.PageSize); diff --git a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs index 831e80e5..dacc6947 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackStatusRepository.cs @@ -45,7 +45,8 @@ public class TrackStatusRepository : BasicRepository, ITrackS .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b, c, d) => a.Status.Contains(input.Keywords) || a.EnStatus.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => a.CreateTime, OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b, c, d) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b, c, d) => new GetTrackStatusListVO { Id = a.Id, diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index 6e254c16..57d3ab38 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -24,13 +24,13 @@ public class TrackTemplateRepository : BasicRepository, ITr .Where((a, b) => a.Id == id) .Select((a, b) => new GetTrackTemplateDetailVO - { - Id = a.Id, - Code = a.Code, - Name = a.Name, - SubSystemId = a.SubSystemId, - SubSystem = b.CnName - }).FirstAsync(); + { + Id = a.Id, + Code = a.Code, + Name = a.Name, + SubSystemId = a.SubSystemId, + SubSystem = b.CnName + }).FirstAsync(); return detail; } @@ -47,7 +47,8 @@ public class TrackTemplateRepository : BasicRepository, ITr .WhereIF(input.SubSystemId > 0, (a, b) => a.SubSystemId == input.SubSystemId) .WhereIF(!input.Keywords.IsNullOrWhiteSpace(), (a, b) => a.Name.Contains(input.Keywords) || a.Code.Contains(input.Keywords)) - .OrderByIF(!input.SelectIds.IsNullOrEmpty(),(a,b)=> SqlFunc.IIF(input.SelectIds.Contains(a.Id),SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) + .OrderByIF(input.SelectIds.IsNullOrEmpty(), (a, b) => a.CreateTime,OrderByType.Desc) + .OrderByIF(!input.SelectIds.IsNullOrEmpty(), (a, b) => SqlFunc.IIF(input.SelectIds.Contains(a.Id), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), a.CreateTime), OrderByType.Desc) .Select((a, b) => new GetTrackTemplateListVO { Id = a.Id,