content: package me.flyray.rest.util;
  
  import java.io.Serializable;
  
  /**
   * 分页工具类
   */
  public class PageUtils implements Serializable {
  	private static final long serialVersionUID = 1L;
  	//总记录数
  	private int totalCount;
  	//每页记录数
  	private int pageSize;
  	//总页数
  	private int totalPage;
  	//当前页数
  	private int currentPage;
  	
  	/**
  	 * 分页
  	 * @param list        列表数据
  	 * @param totalCount  总记录数
  	 * @param pageSize    每页记录数
  	 * @param currentPage    当前页数
  	 */
  	public PageUtils(int totalCount, int pageSize, int currentPage) {
  		this.totalCount = totalCount;
  		this.pageSize = pageSize;
  		this.currentPage = currentPage;
  		this.totalPage = (int)Math.ceil((double)totalCount/pageSize);
  	}
  
  	public int getTotalCount() {
  		return totalCount;
  	}
  
  	public void setTotalCount(int totalCount) {
  		this.totalCount = totalCount;
  	}
  
  	public int getPageSize() {
  		return pageSize;
  	}
  
  	public void setPageSize(int pageSize) {
  		this.pageSize = pageSize;
  	}
  
  	public int getTotalPage() {
  		return totalPage;
  	}
  
  	public void setTotalPage(int totalPage) {
  		this.totalPage = totalPage;
  	}
  
  	public int getCurrentPage() {
  		return currentPage;
  	}
  
  	public void setCurrentPage(int currentPage) {
  		this.currentPage = currentPage;
  	}
  
  	@Override
  	public String toString() {
  		return "PageUtils [totalCount=" + totalCount + ", pageSize=" + pageSize + ", totalPage=" + totalPage
  				+ ", currentPage=" + currentPage + "]";
  	}
  }
  