代码拉取完成,页面将自动刷新
同步操作将从 abel533/Mybatis_PageHelper 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import org.apache.ibatis.session.RowBounds;
import java.util.ArrayList;
import java.util.List;
/**
* Description: 分页
* Author: liuzh
* Update: liuzh(2014-04-16 10:56)
* Update: liuzh(2014-05-21 20:07)
*/
public class Page<E> extends ArrayList<E> {
/**不进行count查询*/
public static final int NO_SQL_COUNT = -1;
public static final int SQL_COUNT = 0;
private int pageNum;
private int pageSize;
private int startRow;
private int endRow;
private long total;
private int pages;
public Page(int pageNum, int pageSize) {
this(pageNum, pageSize, SQL_COUNT);
}
public Page(int pageNum, int pageSize, int total) {
super(pageSize);
this.pageNum = pageNum;
this.pageSize = pageSize;
this.total = total;
this.startRow = pageNum > 0 ? (pageNum - 1) * pageSize : 0;
this.endRow = pageNum * pageSize;
}
public Page(RowBounds rowBounds){
super(rowBounds.getLimit());
this.pageSize = rowBounds.getLimit();
this.startRow = rowBounds.getOffset();
//RowBounds方式默认不求count总数,如果想求count,可以修改这里为SQL_COUNT
this.total = NO_SQL_COUNT;
this.endRow = this.startRow+this.pageSize;
}
public List<E> getResult() {
return this;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public int getEndRow() {
return endRow;
}
public void setEndRow(int endRow) {
this.endRow = endRow;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getStartRow() {
return startRow;
}
public void setStartRow(int startRow) {
this.startRow = startRow;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
@Override
public String toString() {
return "Page{" +
"pageNum=" + pageNum +
", pageSize=" + pageSize +
", startRow=" + startRow +
", endRow=" + endRow +
", total=" + total +
", pages=" + pages +
'}';
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。