1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| package com.tradingplatform.dto;
import java.util.List;
public class PageJumpDataDto<T> { private int currentPage=1; private int totalPage=0; private int totalRecord=0; private List<T> listData; private int pageSize=6; public PageJumpDataDto() {}
public PageJumpDataDto(int currentPage, int totalPage, int totalRecord, List<T> listData, int pageSize) { super(); this.currentPage = currentPage; this.totalPage = totalPage; this.totalRecord = totalRecord; this.listData = listData; this.pageSize = pageSize; } public PageJumpDataDto(int currentPage, List<T> listData) { if(listData==null) return; this.totalRecord = listData.size(); this.totalPage = this.totalRecord/this.pageSize; if(this.totalRecord%this.pageSize!=0) this.totalPage+=1; if(this.totalPage<currentPage){ this.currentPage=this.totalPage; }else{ this.currentPage=currentPage; } if(this.currentPage<1) this.currentPage=1; int begin=this.pageSize*(this.currentPage-1); int end= (this.pageSize*this.currentPage)>this.totalRecord?this.totalRecord:(this.pageSize*this.currentPage); this.listData=listData.subList(begin, end); } public PageJumpDataDto(int currentPage, List<T> listData,int pageSize) { if(listData==null) return; this.pageSize=pageSize; this.totalRecord = listData.size(); this.totalPage = this.totalRecord/this.pageSize; if(this.totalRecord%this.pageSize!=0) this.totalPage+=1; if(this.totalPage<currentPage){ this.currentPage=this.totalPage; }else{ this.currentPage=currentPage; } if(this.currentPage<1) this.currentPage=1; int begin=this.pageSize*(this.currentPage-1); int end= (this.pageSize*this.currentPage)>this.totalRecord?this.totalRecord:(this.pageSize*this.currentPage); this.listData=listData.subList(begin, end); }
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 getTotalRecord() { return totalRecord; } public void setTotalRecord(int totalRecord) { this.totalRecord = totalRecord; }
public List<T> getListData() { return listData; }
public void setListData(List<T> listData) { this.listData = listData; }
public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } }
|