using Mapster;
using SqlSugar;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market;
using Yi.Framework.DigitalCollectibles.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.DigitalCollectibles.Application.Services;
///
/// 市场应用服务
///
public class MarketService:ApplicationService
{
private readonly ISqlSugarRepository _marketGoodsRepository;
public MarketService(ISqlSugarRepository marketGoodsRepository)
{
_marketGoodsRepository = marketGoodsRepository;
}
///
/// 交易市场查询
///
///
///
public async Task> GetListAsync(MarketGetListInput input)
{
RefAsync total = 0;
var entities = await _marketGoodsRepository._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.SkipCount, input.MaxResultCount, total);
var output = entities.Adapt>();
return new PagedResultDto(total, output);
}
}