Merge pull request 'S01-轨迹中台' (#34) from S01-轨迹中台 into dev
Reviewed-on: http://192.168.80.50:3000/Dotnet/SJZY.Track.Api/pulls/34
This commit is contained in:
commit
2841ae66da
@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板内容下拉框
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("GetContentDropDownList")]
|
||||
public async Task<List<DropdownListDataDto>> GetContentDropDownListAsync([FromBody] GetTrackTemplateContentDropDownListVO input)
|
||||
{
|
||||
return await _trackTemplateRepository.GetContentDropDownListAsync(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板内容编辑
|
||||
/// </summary>
|
||||
|
||||
@ -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<TrackTemplateEntity
|
||||
Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
||||
|
||||
Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs);
|
||||
|
||||
Task<List<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input);
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
namespace SJZY.Track.Domain.Dtos.TrackTemplate;
|
||||
|
||||
public class GetTrackTemplateContentDropDownListVO : PageInfoInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 轨迹模板id
|
||||
/// </summary>
|
||||
public List<int> TrackTemplateIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选中项
|
||||
/// </summary>
|
||||
public List<int>? SelectedIds { get; set; }
|
||||
}
|
||||
@ -6,9 +6,4 @@ public class GetTrackTemplateContentPageInputVO : PageInfoInput
|
||||
/// 轨迹模板id
|
||||
/// </summary>
|
||||
public List<int> TrackTemplateIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选中项
|
||||
/// </summary>
|
||||
public List<int>? SelectedIds { get; set; }
|
||||
}
|
||||
@ -85,8 +85,6 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, 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<TrackTemplateEntity>, ITr
|
||||
UpdateTime = templateContent.UpdateTime,
|
||||
UpdateUser = updateUser.Name
|
||||
}, true)
|
||||
.Distinct()
|
||||
.ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
@ -165,4 +162,20 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
{
|
||||
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
|
||||
public async Task<List<DropdownListDataDto>> GetContentDropDownListAsync(GetTrackTemplateContentDropDownListVO input)
|
||||
{
|
||||
return await Context.Queryable<TrackTemplateContentEntity>()
|
||||
.InnerJoin<TrackContentEntity>((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();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user