Page.java 852 Bytes
Newer Older
yuquan.zhu committed
1 2 3 4
package cn.timer.api.utils;

/**
 * 分页查询工具类
tangzhaoqian committed
5
 * 
yuquan.zhu committed
6 7 8 9 10
 * @author Administrator
 *
 */

public class Page {
tangzhaoqian committed
11 12 13 14
	
	/**
	 * 当前页
	 */
yuquan.zhu committed
15
	private Integer currentPage;
16
	
tangzhaoqian committed
17 18 19 20 21
	/**
	 * 每页总条数
	 */
	private Integer totalPage;

mobh committed
22 23 24 25 26
	/**
	 * 偏移
	 */
	private Integer offset;

27 28 29
	public Integer getCurrentPage() {
		return currentPage == null || currentPage <= 0 ? 1 : currentPage;
	}
tangzhaoqian committed
30

31
	public void setCurrentPage(Integer currentPage) {
tangzhaoqian committed
32

33 34
		this.currentPage = currentPage;
	}
tangzhaoqian committed
35

36 37 38
	public Integer getTotalPage() {
		return totalPage == null || totalPage <= 0 ? 10 : totalPage;
	}
tangzhaoqian committed
39

40 41 42
	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
mobh committed
43
	public Integer getOffset() {
mobh committed
44
		return this.getCurrentPage() > 0 ? (this.getCurrentPage() - 1) * this.getTotalPage() : 0;
mobh committed
45
	}
tangzhaoqian committed
46

mobh committed
47 48 49
	public void setOffset(Integer offset) {
		this.offset = offset;
	}
yuquan.zhu committed
50
}