完成 轨迹模板内容排序 接口
This commit is contained in:
parent
df4772b5c5
commit
6c10a6e21c
@ -0,0 +1,11 @@
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
|
||||
namespace SJZY.Track.Application.Contract.Dtos.TrackTemplates;
|
||||
|
||||
public class SortTrackTemplateContentInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 排序信息
|
||||
/// </summary>
|
||||
public List<DropdownListDataDto> SortInfo { get; set; }
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Expand.ABP.Core.Localization;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackTemplates;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
@ -34,7 +35,7 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
_stringLocalizer = stringLocalizer;
|
||||
_trackTemplateRepository = trackTemplateRepository;
|
||||
_trackPullConfigRepository = trackPullConfigRepository;
|
||||
_trackPushConfigRepository=trackPushConfigRepository;
|
||||
_trackPushConfigRepository = trackPushConfigRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -234,4 +235,26 @@ public class TrackTemplateService : ApplicationService, ITransientDependency
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轨迹模板内容排序
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("SortContent")]
|
||||
public async Task<bool> SortContentAsync([FromBody] SortTrackTemplateContentInput input)
|
||||
{
|
||||
List<int> ids = input.SortInfo.Select(x => int.Parse(x.Key)).ToList();
|
||||
|
||||
var trackTemplateContentEntities = await _trackTemplateRepository.GetContentListAsync(x => ids.Contains(x.Id));
|
||||
|
||||
trackTemplateContentEntities.ForEach(item =>
|
||||
{
|
||||
item.Sort = input.SortInfo.Single(x => x.Key == item.Id.ToString()).Value;
|
||||
});
|
||||
|
||||
await _trackTemplateRepository.UpdateContentRangeAsync(trackTemplateContentEntities);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -35,4 +35,6 @@ public interface ITrackTemplateRepository : IBasicRepository<TrackTemplateEntity
|
||||
|
||||
Task<List<TrackTemplateContentEntity>> GetContentListAsync(
|
||||
Expression<Func<TrackTemplateContentEntity, bool>> whereExpression);
|
||||
|
||||
Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs);
|
||||
}
|
||||
@ -158,4 +158,9 @@ public class TrackTemplateRepository : BasicRepository<TrackTemplateEntity>, ITr
|
||||
{
|
||||
return await Context.Queryable<TrackTemplateContentEntity>().Where(whereExpression).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateContentRangeAsync(List<TrackTemplateContentEntity> updateObjs)
|
||||
{
|
||||
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user