pagebean Safari
程序员文章站
2022-07-09 10:25:41
...
import java.util.List;
public class PageBean {
private List list;
private int allRow;
private int currentPage;
private int totalPage;
private int pageSize;
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public int getAllRow() {
return allRow;
}
public void setAllRow(int allRow) {
this.allRow = allRow;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public static int countTotalPage(int pageSize, int allRow) {
int totalPage = allRow % pageSize == 0 ? allRow / pageSize : allRow
/ pageSize + 1;
return totalPage;
}
public static int countOffset(int pageSize, int currentPage) {
final int offset = pageSize * (currentPage - 1);
return offset;
}
public static int countCurrentPage(int page) {
int curPage = (page == 0 ? 1 : page);
return curPage;
}
}
public class PageBean {
private List list;
private int allRow;
private int currentPage;
private int totalPage;
private int pageSize;
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public int getAllRow() {
return allRow;
}
public void setAllRow(int allRow) {
this.allRow = allRow;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public static int countTotalPage(int pageSize, int allRow) {
int totalPage = allRow % pageSize == 0 ? allRow / pageSize : allRow
/ pageSize + 1;
return totalPage;
}
public static int countOffset(int pageSize, int currentPage) {
final int offset = pageSize * (currentPage - 1);
return offset;
}
public static int countCurrentPage(int page) {
int curPage = (page == 0 ? 1 : page);
return curPage;
}
}
上一篇: Lucene-高亮显示
下一篇: Lucene字段
推荐阅读