分页的封装

package www.csdn.dbshop.util;

import java.util.List;

public class Pagination {
	private final static Integer PAGESIZE=5;//每页显示的记录数
	//结合jqery easyui
	//总记录
	private Integer total;
	//显示的记录
	private List rows;
	private Integer from;
	private Integer size;
	private Integer nowpage;//当前页
	private Integer pagesize;//每页显示的记录数
	//构造器
	public Pagination(Integer nowpage, Integer pagesize) {
		//计算当前页
		if(nowpage<0){
			this.nowpage=1;
		}else{
		//当前页
		this.nowpage=nowpage;
		}
		//记录每页显示的记录数
		if(pagesize<0){
			this.pagesize=this.PAGESIZE;
		}else{
			this.pagesize=pagesize;
		}
		//计算开始的记录和结束的记录
		this.from=(this.nowpage-1)*this.pagesize;
		this.size=this.pagesize;
	}
	public Integer getTotal() {
		return total;
	}
	public void setTotal(Integer total) {
		this.total = total;
	}
	public List getRows() {
		return rows;
	}
	public void setRows(List rows) {
		this.rows = rows;
	}
	public Integer getFrom() {
		return from;
	}
	public void setFrom(Integer from) {
		this.from = from;
	}
	public Integer getSize() {
		return size;
	}
	public void setSize(Integer size) {
		this.size = size;
	}
	public Integer getNowpage() {
		return nowpage;
	}
	public void setNowpage(Integer nowpage) {
		this.nowpage = nowpage;
	}
	public Integer getPagesize() {
		return pagesize;
	}
	public void setPagesize(Integer pagesize) {
		this.pagesize = pagesize;
	}
	
}

你可能感兴趣的:(分页的封装)