package com.steerinfo.util;

import java.util.List;

public class PageModels<T> {
	/** 数据集 */
	private List<T> rows;
	/** 总数据条数 */
	private long total = 1;
	/** 每页数据条数 */
	private int pageSize = 10;
	/** 当前页码 */
	private int pageNumber;
	/** 总页数 */
	private long records;
	/** 底部 */
	private List<T> footer;
	
	public PageModels(int pageNumber, int pageSize) {
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
	}

	public long getRecords() {
		if (pageSize != 0) {
			this.records = this.total % this.pageSize == 0 ? this.total / this.pageSize : this.total / this.pageSize + 1;
		} else {
			this.records = 1;
		}
		return records;
	}

	public void setRecords(long records) {
		this.records = records;
	}

	public List<T> getRows() {
		return rows;
	}

	public void setRows(List<T> rows) {
		this.rows = rows;
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public int getPageSize() {
		return pageSize;
	}

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

	public int getPageNumber() {
		return pageNumber;
	}

	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}

	public List<T> getFooter() {
		return footer;
	}

	public void setFooter(List<T> footer) {
		this.footer = footer;
	}
}
