package com.gk.firework.Domain.Utils; import java.util.List; import java.util.Map; public class PageInfo { private final static int PAGESIZE = 10; //默认显示的记录数 private List result; private Long totalCount; private Integer pageSize; private Integer pageIndex; private String sort; private String order; private int from; private int size; private Map condition; //查询条件 public PageInfo() {} //构造方法 public PageInfo(int pageIndex, int pageSize) { //计算当前页 if (pageIndex < 0) { this.pageIndex = 1; } else { //当前页 this.pageIndex = pageIndex; } //记录每页显示的记录数 if (pageSize < 0) { this.pageSize = PAGESIZE; } else { this.pageSize = pageSize; } //计算开始的记录和结束的记录 this.from = (this.pageIndex - 1) * this.pageSize; this.size = this.pageSize; } // 构造方法 public PageInfo(int pageIndex, int pageSize, String sort, String order) { // 计算当前页 if (pageIndex < 0) { this.pageIndex = 1; } else { // 当前页 this.pageIndex = pageIndex; } // 记录每页显示的记录数 if (pageSize < 0) { this.pageSize = PAGESIZE; } else { this.pageSize = pageSize; } // 计算开始的记录和结束的记录 this.from = (this.pageIndex - 1) * this.pageSize; this.size = this.pageSize; // 排序字段,正序还是反序 this.sort = sort; this.order = order; } public List getResult() { return result; } public void setResult(List result) { this.result = result; } public Long getTotalCount() { return totalCount; } public void setTotalCount(Long totalCount) { this.totalCount = totalCount; } public Integer getPageSize() { return pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public Integer getPageIndex() { return pageIndex; } public void setPageIndex(Integer pageIndex) { this.pageIndex = pageIndex; } public String getSort() { return sort; } public void setSort(String sort) { this.sort = sort; } public String getOrder() { return order; } public void setOrder(String order) { this.order = order; } public int getFrom() { return from; } public void setFrom(int from) { this.from = from; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public Map getCondition() { return condition; } public void setCondition(Map condition) { this.condition = condition; } }