From c27e55b69fee6efccfcc71e0fa7392cfedd0ea1d Mon Sep 17 00:00:00 2001 From: hardstylewyl <827778732@qq.com> Date: Fri, 27 Dec 2024 15:52:36 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E8=8E=B7=E5=8F=96=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8C=89=E6=8E=92=E5=BA=8F=E9=94=AE=E6=8E=92=E5=BA=8F=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/TrackTemplate/TrackTemplateOutputVo.cs | 5 +++++ .../Repositories/TrackTemplateRepository.cs | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TrackTemplateOutputVo.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/TrackTemplateOutputVo.cs index f84f4294..9996c9b7 100644 --- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/TrackTemplateOutputVo.cs +++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/TrackTemplateOutputVo.cs @@ -54,4 +54,9 @@ public class TemplateContentDtoVo /// 轨迹节点 /// public string Node { get; set; } + + /// + /// 排序键 + /// + public int Sort { get; set; } } diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs index d399bcd1..2f9b4a2d 100644 --- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs @@ -214,7 +214,8 @@ public class TrackTemplateRepository : BasicRepository, ITr ContentCn = b.Content, ContentEn = b.EnContent, Status = c.Status, - Node = d.NodeName + Node = d.NodeName, + Sort = a.Sort }) .ToListAsync(); @@ -222,7 +223,8 @@ public class TrackTemplateRepository : BasicRepository, ITr { var templateContents = contents.Where(x => x.TemplateId == template.Id).ToList(); - template.TemplateContents = templateContents; + //根据排序键排序 + template.TemplateContents = templateContents.OrderBy(x => x.Sort).ToList(); } return templates; @@ -262,10 +264,13 @@ public class TrackTemplateRepository : BasicRepository, ITr ContentCn = b.Content, ContentEn = b.EnContent, Status = c.Status, - Node = d.NodeName + Node = d.NodeName, + Sort = a.Sort }) .ToPagedListAsync(input.PageIndex, input.PageSize); + //返回轨迹模板内容时按排序键排序 + contents.List = contents.List.OrderBy(x => x.Sort).ToList(); return contents; }