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