46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DG.Core
|
|
{
|
|
public class PageResult<TData> where TData : class
|
|
{
|
|
public PageResult(int pageIndex, int pageSize, int total, IList<TData>? data)
|
|
{
|
|
PageIndex = pageIndex;
|
|
PageSize = pageSize;
|
|
Total = total;
|
|
Data = data;
|
|
TotalCount = total == 0 ? 0 : (Total / PageSize) + (Total % PageSize) > 0 ? 1 : 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 页数
|
|
/// </summary>
|
|
public int PageIndex { get; set; }
|
|
|
|
/// <summary>
|
|
/// 分页大小
|
|
/// </summary>
|
|
public int PageSize { get; set; }
|
|
|
|
/// <summary>
|
|
/// 总数量
|
|
/// </summary>
|
|
public int Total { get; set; }
|
|
|
|
/// <summary>
|
|
/// 分页总数量
|
|
/// </summary>
|
|
public int TotalCount { get; set; }
|
|
|
|
/// <summary>
|
|
/// 数据
|
|
/// </summary>
|
|
public IList<TData>? Data { get; set; }
|
|
}
|
|
}
|