public async Task<PagedResult<ClientInfoDTO>> GetPageAsync( ClientQueryDTO q )
{
var query = await this._clientService.GetQueryableAsync( q );
var total = query.DeferredCount().FutureValue();
switch ( q.OrderBy )
{
case "Id": query = q.IsAsc ? query.OrderByDescending( p => p.Id ) : query.OrderBy( p => p.Id ); break;
default: query = query.OrderByDescending( p => p.CreateDateTime ); break;// 默认按照ID排序
}
var page = query.Skip( ( q.pageNo - 1 ) * q.pageSize ).Take( q.pageSize ).ProjectTo<ClientInfoDTO>( this._mapper.ConfigurationProvider ).Future();
var aa = await page.ToListAsync();
return new PagedResult<ClientInfoDTO>( aa, total.Value );
}