using SqlSugar; using Yi.Framework.Infrastructure.Ddd.Dtos; using Yi.Framework.Infrastructure.Ddd.Services; using Yi.Furion.Application.App.Services; using Yi.Furion.Core.App.Dtos.Trends; using Yi.Furion.Core.App.Entities; namespace Yi.Furion.Application.App.Services.Impl { /// /// Trends服务实现 /// [ApiDescriptionSettings("APP")] public class TrendsService : CrudAppService, ITrendsService, IDynamicApiController, ITransient { /// /// 多查 /// /// /// public override async Task> GetListAsync(TrendsGetListInput input) { var entity = await MapToEntityAsync(input); RefAsync total = 0; var entities = await _DbQueryable .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) .OrderByDescending(x=>x.CreationTime) .ToPageListAsync(input.PageNum, input.PageSize, total); return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); } /// /// 发布文章 /// /// /// public override Task CreateAsync(TrendsCreateInput input) { if (string.IsNullOrEmpty(input.Title)) { input.Title = input.Content.Substring(0, Math.Min(5, input.Content.Length)); } return base.CreateAsync(input); } } }