PagedInfo.cs 1.2 KB

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