using System;
using System.Collections.Generic;
namespace Masuit.Tools.Models;
///
/// 分页集合
///
///
public class PagedList
{
///
/// 数据集
///
public List Data { get; }
///
/// 当前页
///
public int CurrentPage { get; set; }
///
/// 总页数
///
public int TotalPages { get; }
///
/// 页大小
///
public int PageSize { get; }
///
/// 总条数
///
public int TotalCount { get; }
///
/// 当前页数据条数
///
public int CurrentCount => Data.Count;
///
/// 是否有前一页
///
public bool HasPrev => CurrentPage > 1;
///
/// 是否有后一页
///
public bool HasNext => CurrentPage < TotalPages;
///
/// 分页数据
///
/// 数据集
/// 当前页
/// 页大小
/// 总条数
public PagedList(List items, int page, int size, int count)
{
TotalCount = count;
PageSize = size;
CurrentPage = page;
TotalPages = (int)Math.Ceiling(count * 1.0 / size);
Data = items;
}
public PagedList()
{
}
}