You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
576 B
C#

using EntrustSettle.Model;
using SqlSugar;
using System.Threading.Tasks;
namespace EntrustSettle.Common.Extensions;
/// <summary>
/// 分页拓展类
/// </summary>
public static class PagedQueryableExtensions
{
public static async Task<PageModel<TEntity>> ToPageListAsyncExtension<TEntity>(this ISugarQueryable<TEntity> query, int pageIndex, int pageSize)
{
RefAsync<int> totalCount = 0;
var data = await query.ToPageListAsync(pageIndex, pageSize, totalCount);
return new PageModel<TEntity>(pageIndex, totalCount, pageSize, data);
}
}