package cn.itheima.store.product.domain;import java.io.Serializable;import java.util.List;public class PageBean<T> implements Serializable{ private in ...
package cn.itheima.store.product.domain;
import java.io.Serializable;
import java.util.List;
public class PageBean<T> implements Serializable{
private int startIndex;//起始索引 需要計算出來
private int pageSize;//一頁顯示條數 固定賦值
private int pageNumber;//當前頁 前臺傳遞
private List<T> list;//分頁查詢出來的數據
private int totalRecord;//總記錄數 需要查詢出來
private int totalPage;//總頁數 Math.ceil
public int getStartIndex() {
// return startIndex;
return startIndex = (this.getPageNumber()-1)*this.getPageSize();
}
public void setStartIndex(int startIndex) {
this.startIndex = startIndex;
}
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> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
public int getTotalRecord() {
return totalRecord;
}
public void setTotalRecord(int totalRecord) {
this.totalRecord = totalRecord;
}
public int getTotalPage() {
// return totalPage;
return totalPage = (this.getTotalRecord()%this.getPageSize()==0?(this.getTotalRecord()/this.getPageSize()):(this.getTotalRecord()/this.getPageSize()+1));
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public PageBean() {
super();
// TODO Auto-generated constructor stub
}
}