PageModel

package com.itsv.yiliao.back.personnel.model;

import java.util.List;
/**
 * 分页模型
 * @author kingmxj 2009-11-11
 *
 */
public class PageModel {
	
	private List list;//存储的数据
	
	private int totalRecords;//总条数
	
	private int pageSize = 10;//每页显示数量
	
	private int pageNo = 1;//页号
	
	private int totalPages;//总页数
	
	private boolean firstPage;//是不是第一页
	
	private boolean lastPage;//是不是最后一页
	
	/**
	 * 取得首页
	 * @return
	 */
	public int getTopPageNo() {
		return 1;
	}
	
	/**
	 * 上一页
	 * @return
	 */
	public int getPreviousPageNo() {
		if (this.pageNo <= 1){
			return 1;
		}
		return this.pageNo - 1;
	}
	
	/**
	 * 下一页
	 * @return
	 */
	public int getNextPageNo() {
		if (this.pageNo >= this.getBottomPageNo()) {
			return this.getBottomPageNo();
		}
		return this.pageNo + 1;
	}
	
	/**
	 * 尾页
	 * @return
	 */
	public int getBottomPageNo() {
		return this.getTotalPages();
	}
	
	/**
	 * 总页数
	 * @return
	 */
	public int getTotalPages() {
		if(this.totalRecords==0){
			return 1;
		}
		return (this.totalRecords + this.pageSize - 1)/this.pageSize;
	}

	/**
	 * 是不是首页
	 * @return
	 */
	public boolean isFirstPage() {
		if(pageNo==1){
			return true;
		}
		return false;
	}

	/**
	 * 是不是末页
	 * @return
	 */
	public boolean isLastPage() {
		if(pageNo==totalPages){
			return true;
		}
		return false;
	}
	
	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}

	public int getTotalRecords() {
		return totalRecords;
	}

	public void setTotalRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}

	public void setFirstPage(boolean firstPage) {
		this.firstPage = firstPage;
	}

	public void setLastPage(boolean lastPage) {
		this.lastPage = lastPage;
	}
	
	
}

你可能感兴趣的:(Model)