190 lines
3.0 KiB
Java
190 lines
3.0 KiB
Java
package seed.utils;
|
|
|
|
public class Paging {
|
|
|
|
protected Integer page;
|
|
protected Integer row;
|
|
protected Long count;
|
|
protected Integer pages;
|
|
protected Integer blocks;
|
|
protected Integer block;
|
|
protected Integer fPage;
|
|
protected Integer lPage;
|
|
|
|
protected Integer pagec;
|
|
protected Integer rowc;
|
|
protected Long countc;
|
|
protected Integer pagesc;
|
|
protected Integer blocksc;
|
|
protected Integer blockc;
|
|
protected Integer fPagec;
|
|
protected Integer lPagec;
|
|
|
|
public Long getCount() {
|
|
return count;
|
|
}
|
|
|
|
public void setCount(Long count) {
|
|
|
|
if(page == null || page < 0){
|
|
page = 1;
|
|
}
|
|
|
|
if(row == null || row < 0){
|
|
row = 10;
|
|
}
|
|
|
|
this.count = count;
|
|
pages = (count == 0) ? 1 : (int) ((count - 1) / row) + 1;
|
|
blocks = (int) Math.ceil(1.0 * pages / 10.0);
|
|
block = (int) Math.ceil(1.0 * page / 10.0);
|
|
fPage = (block - 1) * 10 + 1;
|
|
lPage = block * 10;
|
|
if (lPage > pages)
|
|
lPage = pages;
|
|
|
|
if(page > pages){
|
|
page = pages;
|
|
}
|
|
}
|
|
|
|
public Long getCountc() {
|
|
return countc;
|
|
}
|
|
|
|
public void setCountc(Long countc) {
|
|
|
|
if(pagec == null || pagec < 0){
|
|
pagec = 1;
|
|
}
|
|
|
|
if(rowc == null || rowc < 0){
|
|
rowc = 10;
|
|
}
|
|
|
|
this.countc = countc;
|
|
pagesc = (countc == 0) ? 1 : (int) ((countc - 1) / rowc) + 1;
|
|
blocksc = (int) Math.ceil(1.0 * pagesc / 10.0);
|
|
blockc = (int) Math.ceil(1.0 * pagec / 10.0);
|
|
fPagec = (blockc - 1) * 10 + 1;
|
|
lPagec = blockc * 10;
|
|
if (lPagec > pagesc)
|
|
lPagec = pagesc;
|
|
|
|
if(pagec > pagesc){
|
|
pagec = pagesc;
|
|
}
|
|
}
|
|
|
|
public Integer getPage() {
|
|
return page;
|
|
}
|
|
|
|
public void setPage(Integer page) {
|
|
this.page = page;
|
|
}
|
|
|
|
public Integer getRow() {
|
|
return row;
|
|
}
|
|
|
|
public void setRow(Integer row) {
|
|
this.row = row;
|
|
}
|
|
|
|
public Integer getPages() {
|
|
return pages;
|
|
}
|
|
|
|
public void setPages(Integer pages) {
|
|
this.pages = pages;
|
|
}
|
|
|
|
public Integer getBlocks() {
|
|
return blocks;
|
|
}
|
|
|
|
public void setBlocks(Integer blocks) {
|
|
this.blocks = blocks;
|
|
}
|
|
|
|
public Integer getBlock() {
|
|
return block;
|
|
}
|
|
|
|
public void setBlock(Integer block) {
|
|
this.block = block;
|
|
}
|
|
|
|
public Integer getfPage() {
|
|
return fPage;
|
|
}
|
|
|
|
public void setfPage(Integer fPage) {
|
|
this.fPage = fPage;
|
|
}
|
|
|
|
public Integer getlPage() {
|
|
return lPage;
|
|
}
|
|
|
|
public void setlPage(Integer lPage) {
|
|
this.lPage = lPage;
|
|
}
|
|
|
|
public Integer getPagec() {
|
|
return pagec;
|
|
}
|
|
|
|
public void setPagec(Integer pagec) {
|
|
this.pagec = pagec;
|
|
}
|
|
|
|
public Integer getRowc() {
|
|
return rowc;
|
|
}
|
|
|
|
public void setRowc(Integer rowc) {
|
|
this.rowc = rowc;
|
|
}
|
|
|
|
public Integer getPagesc() {
|
|
return pagesc;
|
|
}
|
|
|
|
public void setPagesc(Integer pagesc) {
|
|
this.pagesc = pagesc;
|
|
}
|
|
|
|
public Integer getBlocksc() {
|
|
return blocksc;
|
|
}
|
|
|
|
public void setBlocksc(Integer blocksc) {
|
|
this.blocksc = blocksc;
|
|
}
|
|
|
|
public Integer getBlockc() {
|
|
return blockc;
|
|
}
|
|
|
|
public void setBlockc(Integer blockc) {
|
|
this.blockc = blockc;
|
|
}
|
|
|
|
public Integer getfPagec() {
|
|
return fPagec;
|
|
}
|
|
|
|
public void setfPagec(Integer fPagec) {
|
|
this.fPagec = fPagec;
|
|
}
|
|
|
|
public Integer getlPagec() {
|
|
return lPagec;
|
|
}
|
|
|
|
public void setlPagec(Integer lPagec) {
|
|
this.lPagec = lPagec;
|
|
}
|
|
} |