diff --git a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
index 621ae61a..1beb3bed 100644
--- a/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
+++ b/src/SJZY.Track.Application/Services/TrackTemplates/TrackTemplateService.cs
@@ -1,6 +1,7 @@
using System.Linq.Expressions;
using Microsoft.Extensions.Localization;
using SJZY.Expand.ABP.Core.Localization;
+using SJZY.Expand.ABP.Core.PublicMethords;
using SJZY.Track.Application.Contract.Dtos.TrackPush;
using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
using SJZY.Track.Application.Localization;
@@ -183,6 +184,17 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
return await _trackTemplateRepository.GetContentDetailAsync(id);
}
+ ///
+ /// 轨迹模板内容下拉框
+ ///
+ ///
+ ///
+ [HttpPost("GetContentDropDownList")]
+ public async Task> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input)
+ {
+ return await _trackTemplateRepository.GetContentDropDownListAsync(input);
+ }
+
///
/// 轨迹模板内容编辑
///
diff --git a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
index 3654043b..86e3041b 100644
--- a/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
+++ b/src/SJZY.Track.Domain/Aggregates/TrackTemplateAggregate/ITrackTemplateRepository.cs
@@ -1,4 +1,5 @@
-using SJZY.Track.Domain.Dtos.TrackTemplate;
+using SJZY.Expand.ABP.Core.PublicMethords;
+using SJZY.Track.Domain.Dtos.TrackTemplate;
namespace SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
@@ -37,4 +38,6 @@ public interface ITrackTemplateRepository : IBasicRepository> whereExpression);
Task UpdateContentRangeAsync(List updateObjs);
+
+ Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input);
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDropDownListVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDropDownListVO.cs
new file mode 100644
index 00000000..ab4a6f8c
--- /dev/null
+++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentDropDownListVO.cs
@@ -0,0 +1,14 @@
+namespace SJZY.Track.Domain.Dtos.TrackTemplate;
+
+public class GetTrackTemplateContentDropDownListVO : PageInfoInput
+{
+ ///
+ /// 轨迹模板id
+ ///
+ public List TrackTemplateIds { get; set; }
+
+ ///
+ /// 选中项
+ ///
+ public List? SelectedIds { get; set; }
+}
\ No newline at end of file
diff --git a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs
index 14b1f0ee..09e8f51f 100644
--- a/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs
+++ b/src/SJZY.Track.Domain/Dtos/TrackTemplate/GetTrackTemplateContentPageInputVO.cs
@@ -6,9 +6,4 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput
/// 轨迹模板id
///
public List TrackTemplateIds { get; set; }
-
- ///
- /// 选中项
- ///
- public List? SelectedIds { get; set; }
}
\ No newline at end of file
diff --git a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs
index d97ef892..ed1c75f4 100644
--- a/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs
+++ b/src/SJZY.Track.Repository/Repositories/TrackTemplateRepository.cs
@@ -85,8 +85,6 @@ public class TrackTemplateRepository : BasicRepository, ITr
templateContent.UpdateUserId == updateUser.Id && !updateUser.IsDeleted)
.Filter(null, true)
.Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId) && !templateContent.IsDeleted)
- .OrderByIF(input.SelectedIds.IsNullOrEmpty(), templateContent => templateContent.CreateTime, OrderByType.Desc)
- .OrderByIF(!input.SelectedIds.IsNullOrEmpty(), templateContent => SqlFunc.IIF(input.SelectedIds.Contains(templateContent.TrackContentId), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), templateContent.CreateTime), OrderByType.Desc)
.Select((templateContent, trackContent, trackStatus, enumValue, trackFlag, createUser, updateUser) =>
new GetTrackTemplateContentPageOutputVO
{
@@ -99,7 +97,6 @@ public class TrackTemplateRepository : BasicRepository, ITr
UpdateTime = templateContent.UpdateTime,
UpdateUser = updateUser.Name
}, true)
- .Distinct()
.ToPagedListAsync(input.PageIndex, input.PageSize);
}
@@ -165,4 +162,20 @@ public class TrackTemplateRepository : BasicRepository, ITr
{
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
}
+
+ public async Task> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input)
+ {
+ return await Context.Queryable()
+ .InnerJoin((templateContent, trackContent) => templateContent.TrackContentId == trackContent.Id)
+ .Where(templateContent => input.TrackTemplateIds.Contains(templateContent.TrackTemplateId))
+ .OrderByIF(input.SelectedIds.IsNullOrEmpty(), templateContent => templateContent.CreateTime, OrderByType.Desc)
+ .OrderByIF(!input.SelectedIds.IsNullOrEmpty(), templateContent => SqlFunc.IIF(input.SelectedIds.Contains(templateContent.TrackContentId), SqlFunc.DateAdd(SqlFunc.GetDate(), 1), templateContent.CreateTime), OrderByType.Desc)
+ .Select((templateContent, trackContent) => new DropdownListDataDto
+ {
+ Value = templateContent.TrackContentId,
+ Key = trackContent.Code + "-" + trackContent.Content
+ })
+ .Distinct()
+ .ToListAsync();
+ }
}
\ No newline at end of file