完成 轨迹推送配置内容排序 接口
This commit is contained in:
parent
51099d850b
commit
92f61e1a1b
@ -1,9 +1,11 @@
|
|||||||
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
|
|
||||||
public class SortTrackPushContentInput
|
public class SortTrackPushContentInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 排序信息
|
/// 排序信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Dictionary<int, int>> SortInfo { get; set; }
|
public List<DropdownListDataDto> SortInfo { get; set; }
|
||||||
}
|
}
|
||||||
@ -4,7 +4,6 @@ using SJZY.Expand.ABP.Core.Localization;
|
|||||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||||
using SJZY.Track.Application.Localization;
|
using SJZY.Track.Application.Localization;
|
||||||
using SJZY.Track.Domain.Aggregates.DemoAggregate;
|
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackPushAggregate;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackTemplateAggregate;
|
||||||
@ -246,6 +245,17 @@ public class TrackPushService : ApplicationService, ITransientDependency
|
|||||||
[HttpPost("SortContent")]
|
[HttpPost("SortContent")]
|
||||||
public async Task<bool> SortContentAsync([FromBody] SortTrackPushContentInput input)
|
public async Task<bool> SortContentAsync([FromBody] SortTrackPushContentInput input)
|
||||||
{
|
{
|
||||||
|
List<int> ids = input.SortInfo.Select(x => int.Parse(x.Key)).ToList();
|
||||||
|
|
||||||
|
var trackPushContentEntities = await _trackPushConfigRepository.GetContentListAsync(x => ids.Contains(x.Id));
|
||||||
|
|
||||||
|
trackPushContentEntities.ForEach(item =>
|
||||||
|
{
|
||||||
|
item.Sort = input.SortInfo.Single(x => x.Key == item.Id.ToString()).Value;
|
||||||
|
});
|
||||||
|
|
||||||
|
await _trackPushConfigRepository.UpdateContentRangeAsync(trackPushContentEntities);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -22,4 +22,8 @@ public interface ITrackPushConfigRepository : IBasicRepository<TrackPushConfigEn
|
|||||||
Task<TrackPushContentConfigEntity> GetContentByIdAsync(int id);
|
Task<TrackPushContentConfigEntity> GetContentByIdAsync(int id);
|
||||||
|
|
||||||
Task<bool> UpdateContentAsync(TrackPushContentConfigEntity updateObj);
|
Task<bool> UpdateContentAsync(TrackPushContentConfigEntity updateObj);
|
||||||
|
|
||||||
|
Task<List<TrackPushContentConfigEntity>> GetContentListAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression);
|
||||||
|
|
||||||
|
Task<bool> UpdateContentRangeAsync(List<TrackPushContentConfigEntity> updateObjs);
|
||||||
}
|
}
|
||||||
@ -114,4 +114,14 @@ public class TrackPushConfigRepository : BasicRepository<TrackPushConfigEntity>,
|
|||||||
{
|
{
|
||||||
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
|
return await Context.Updateable(updateObj).ExecuteCommandHasChangeAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<TrackPushContentConfigEntity>> GetContentListAsync(Expression<Func<TrackPushContentConfigEntity, bool>> whereExpression)
|
||||||
|
{
|
||||||
|
return await Context.Queryable<TrackPushContentConfigEntity>().Where(whereExpression).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateContentRangeAsync(List<TrackPushContentConfigEntity> updateObjs)
|
||||||
|
{
|
||||||
|
return await Context.Updateable(updateObjs).ExecuteCommandHasChangeAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user