From 8962bc4055ddc657848a713a87c0806aaf61e6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=87=E7=BF=94?= <878130837@qq.com> Date: Tue, 27 Feb 2024 19:42:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E8=BD=A8=E8=BF=B9?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrackTemplates/TrackTemplateService.cs | 11 +++++ .../Dtos/GetContentDetailOutputVO.cs | 42 +++++++++++++++++++ .../Dtos/GetContentPageOutputVO.cs | 8 ++-- .../ITrackTemplateRepository.cs | 12 ++++++ .../TrackTemplateRepository.cs | 23 +++++++--- 5 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs index c901720b..d0920499 100644 --- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs +++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs @@ -115,4 +115,15 @@ public class TrackTemplateService : ApplicationService, ITrackTemplateService, I { return await _trackTemplateRepository.GetContentPageAsync(input); } + + /// + /// 轨迹模板内容详情 + /// + /// + /// + [HttpGet("GetContentDetail")] + public async Task GetContentDetailAsync(int id) + { + return await _trackTemplateRepository.GetContentDetailAsync(id); + } } \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs new file mode 100644 index 00000000..0f67eed7 --- /dev/null +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentDetailOutputVO.cs @@ -0,0 +1,42 @@ +namespace SJZY.Track.Domain.TrackTemplateAggregate.Dtos +{ + public class GetContentDetailOutputVO + { + public int Id { get; set; } + + /// + /// 是否可删 + /// + public bool IsCanDelete { get; set; } + + /// + /// 是否对外 + /// + public bool IsExternal { get; set; } + + /// + /// 排序 + /// + public int Sort { get; set; } + + /// + /// 轨迹内容 + /// + public string TrackContent { get; set; } + + /// + /// 轨迹内容id + /// + public int TrackContentId { get; set; } + + /// + /// 轨迹状态 + /// + public string TrackStatus { get; set; } + + /// + /// 轨迹状态id + /// + public int TrackStatusId { get; set; } + } +} \ No newline at end of file diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs index 582cef6a..d008a8ef 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/Dtos/GetContentPageOutputVO.cs @@ -27,17 +27,17 @@ public class GetContentPageOutputVO /// public string EnContent { get; set; } - public long? Id { get; set; } + public int Id { get; set; } /// /// 是否可删 /// - public bool? IsCanDelete { get; set; } + public bool IsCanDelete { get; set; } /// /// 是否对外 /// - public bool? IsExternal { get; set; } + public bool IsExternal { get; set; } /// /// 所属节点 @@ -47,7 +47,7 @@ public class GetContentPageOutputVO /// /// 排序 /// - public long? Sort { get; set; } + public long Sort { get; set; } /// /// 轨迹标记 diff --git a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs index 241f85ca..252a1a44 100644 --- a/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs +++ b/src/SJZY.Track.Domain/TrackTemplateAggregate/ITrackTemplateRepository.cs @@ -10,5 +10,17 @@ public interface ITrackTemplateRepository : IBasicRepository> GetPageTrackTemplate(GetPageTrackTemplateVO input); + /// + /// 轨迹模板内容列表 + /// + /// + /// Task> GetContentPageAsync(GetContentPageInputVO input); + + /// + /// 轨迹模板内容详情 + /// + /// + /// + Task GetContentDetailAsync(int id); } \ No newline at end of file diff --git a/src/SJZY.Track.Repository/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/TrackTemplateRepository.cs index 19308200..4c293af4 100644 --- a/src/SJZY.Track.Repository/TrackTemplateRepository.cs +++ b/src/SJZY.Track.Repository/TrackTemplateRepository.cs @@ -60,11 +60,7 @@ public class TrackTemplateRepository : BasicRepository, ITr return pagedList; } - /// - /// 轨迹模板内容列表 - /// - /// - /// + /// public async Task> GetContentPageAsync(GetContentPageInputVO input) { return await AsSugarClient().Queryable() @@ -89,4 +85,21 @@ public class TrackTemplateRepository : BasicRepository, ITr }, true) .ToPagedListAsync(input.PageIndex, input.PageSize); } + + /// + public async Task GetContentDetailAsync(int id) + { + return await AsSugarClient().Queryable() + .InnerJoin((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id && !trackContent.IsDeleted) + .LeftJoin((templateContent, trackContent, trackStatus) => trackContent.TrackStatusId == trackStatus.Id && !trackStatus.IsDeleted) + .Filter(null, true) + .Where(templateContent => templateContent.Id == id && !templateContent.IsDeleted) + .Select((templateContent, trackContent, trackStatus) => new GetContentDetailOutputVO + { + Id = templateContent.Id, + TrackContent = trackContent.Code + "-" + trackContent.Content, + TrackStatus = trackStatus.Status + }, true) + .SingleAsync(); + } } \ No newline at end of file