first commit
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
using JSMachine.WMS.Domain.IRepository;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JSMachine.WMS.App.Dto
|
||||
{
|
||||
public class PagedResultDto<T>
|
||||
{
|
||||
public static readonly PagedResultDto<T> EmptyPagedResult = new PagedResultDto<T>(0, 0, 0, 0, null);
|
||||
|
||||
#region Public Properties
|
||||
/// <summary>
|
||||
/// 总记录数
|
||||
/// </summary>
|
||||
public int TotalRecords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总页数
|
||||
/// </summary>
|
||||
public int TotalPages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每页的记录数
|
||||
/// </summary>
|
||||
public int PageSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public int PageNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置当前页码的记录
|
||||
/// </summary>
|
||||
public List<T> PageData { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public PagedResultDto()
|
||||
{
|
||||
this.PageData = new List<T>();
|
||||
}
|
||||
|
||||
public PagedResultDto(int totalRecords, int totalPages, int pageSize, int pageNumber, List<T> data)
|
||||
{
|
||||
this.TotalPages = totalPages;
|
||||
this.TotalRecords = totalRecords;
|
||||
this.PageSize = pageSize;
|
||||
this.PageNumber = pageNumber;
|
||||
this.PageData = data;
|
||||
}
|
||||
|
||||
public PagedResultDto(int totalRecords, int pageSize, int pageNumber, List<T> data)
|
||||
{
|
||||
if (pageSize > 0)
|
||||
{
|
||||
this.TotalPages = totalRecords % pageSize == 0 ? totalRecords / pageSize : totalRecords / pageSize + 1;
|
||||
}
|
||||
|
||||
this.TotalRecords = totalRecords;
|
||||
this.PageSize = pageSize;
|
||||
this.PageNumber = pageNumber;
|
||||
this.PageData = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user