package gov.hn.hrss.web.page;
public class Page {
private int pagesize = 10, pagecount, liststep = 20, currentpage = 1,
recordcount, listbegin, listend, recordbegin, recordend = 0;
public Page(int current, int recordcount) {
super();
this.currentpage = current;
this.recordcount = recordcount;
pagecount = (int) Math.ceil((double) recordcount / pagesize);// 求总页数,ceil(num)取整不小于num
if (pagecount < current) {
currentpage = pagecount;// 如果分页变量大总页数,则将分页变量设计为总页数
}
if (current < 1) {
currentpage = 1;// 如果分页变量小于1,则将分页变量设为1
}
listbegin = (current - (int) Math.ceil((double) liststep / 2));
if (listbegin < 1) {
listbegin = 1;
}
listend = current + liststep / 2;// 分页信息显示到第几页
if (listend > pagecount) {
listend = pagecount + 1;
}
recordbegin = (current - 1) * pagesize;
recordend = recordbegin + pagesize;
if (currentpage == pagecount) {
recordend = (int) (recordbegin + pagesize
* (recordcount % pagesize) * 0.1);
}
}
public int getCurrentpage() {
return currentpage;
}
public void setCurrentpage(int currentpage) {
this.currentpage = currentpage;
}
public int getListbegin() {
return listbegin;
}
public void setListbegin(int listbegin) {
this.listbegin = listbegin;
}
public int getListend() {
return listend;
}
public void setListend(int listend) {
this.listend = listend;
}
public int getListstep() {
return liststep;
}
public void setListstep(int liststep) {
this.liststep = liststep;
}
public int getPagesize() {
return pagesize;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getRecordbegin() {
return recordbegin;
}
public void setRecordbegin(int recordbegin) {
this.recordbegin = recordbegin;
}
public int getRecordcount() {
return recordcount;
}
public void setRecordcount(int recordcount) {
this.recordcount = recordcount;
}
public int getRecordend() {
return recordend;
}
public void setRecordend(int recordend) {
this.recordend = recordend;
}
public int getPagecount() {
return pagecount;
}
public void setPagecount(int pagecount) {
this.pagecount = pagecount;
}
}
public class Page {
private int pagesize = 10, pagecount, liststep = 20, currentpage = 1,
recordcount, listbegin, listend, recordbegin, recordend = 0;
public Page(int current, int recordcount) {
super();
this.currentpage = current;
this.recordcount = recordcount;
pagecount = (int) Math.ceil((double) recordcount / pagesize);// 求总页数,ceil(num)取整不小于num
if (pagecount < current) {
currentpage = pagecount;// 如果分页变量大总页数,则将分页变量设计为总页数
}
if (current < 1) {
currentpage = 1;// 如果分页变量小于1,则将分页变量设为1
}
listbegin = (current - (int) Math.ceil((double) liststep / 2));
if (listbegin < 1) {
listbegin = 1;
}
listend = current + liststep / 2;// 分页信息显示到第几页
if (listend > pagecount) {
listend = pagecount + 1;
}
recordbegin = (current - 1) * pagesize;
recordend = recordbegin + pagesize;
if (currentpage == pagecount) {
recordend = (int) (recordbegin + pagesize
* (recordcount % pagesize) * 0.1);
}
}
public int getCurrentpage() {
return currentpage;
}
public void setCurrentpage(int currentpage) {
this.currentpage = currentpage;
}
public int getListbegin() {
return listbegin;
}
public void setListbegin(int listbegin) {
this.listbegin = listbegin;
}
public int getListend() {
return listend;
}
public void setListend(int listend) {
this.listend = listend;
}
public int getListstep() {
return liststep;
}
public void setListstep(int liststep) {
this.liststep = liststep;
}
public int getPagesize() {
return pagesize;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getRecordbegin() {
return recordbegin;
}
public void setRecordbegin(int recordbegin) {
this.recordbegin = recordbegin;
}
public int getRecordcount() {
return recordcount;
}
public void setRecordcount(int recordcount) {
this.recordcount = recordcount;
}
public int getRecordend() {
return recordend;
}
public void setRecordend(int recordend) {
this.recordend = recordend;
}
public int getPagecount() {
return pagecount;
}
public void setPagecount(int pagecount) {
this.pagecount = pagecount;
}
}