Page.java 852 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
package cn.timer.api.utils;

/**
 * 分页查询工具类
 * 
 * @author Administrator
 *
 */

public class Page {
	
	/**
	 * 当前页
	 */
	private Integer currentPage;
	
	/**
	 * 每页总条数
	 */
	private Integer totalPage;

	/**
	 * 偏移
	 */
	private Integer offset;

	public Integer getCurrentPage() {
		return currentPage == null || currentPage <= 0 ? 1 : currentPage;
	}

	public void setCurrentPage(Integer currentPage) {

		this.currentPage = currentPage;
	}

	public Integer getTotalPage() {
		return totalPage == null || totalPage <= 0 ? 10 : totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
	public Integer getOffset() {
		return this.getCurrentPage() > 0 ? (this.getCurrentPage() - 1) * this.getTotalPage() : 0;
	}

	public void setOffset(Integer offset) {
		this.offset = offset;
	}
}