PagedInfo.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections.Generic;
  2. namespace Model.Base
  3. {
  4. /// <summary>
  5. /// 分页参数
  6. /// </summary>
  7. public class PagedInfo<T>
  8. {
  9. /// <summary>
  10. /// 每页行数
  11. /// </summary>
  12. public int PageSize { get; set; } = 10;
  13. /// <summary>
  14. /// 当前页
  15. /// </summary>
  16. public int PageIndex { get; set; } = 1;
  17. /// <summary>
  18. /// 总记录数
  19. /// </summary>
  20. public int Total { get; set; }
  21. /// <summary>
  22. /// 总页数
  23. /// </summary>
  24. public int TotalPage
  25. {
  26. get
  27. {
  28. if (Total > 0)
  29. {
  30. return Total % this.PageSize == 0 ? Total / this.PageSize : Total / this.PageSize + 1;
  31. }
  32. else
  33. {
  34. return 0;
  35. }
  36. }
  37. set { }
  38. }
  39. public List<T> Records { get; set; }
  40. public Dictionary<string, object> Extra { get; set; } = new Dictionary<string, object>();
  41. public PagedInfo()
  42. {
  43. }
  44. }
  45. }