57 lines
1.5 KiB
Java
57 lines
1.5 KiB
Java
package com.pms.common.utils;
|
|
|
|
public class PaginationInfo {
|
|
private int currentPageNo = 1; // 현재 페이지 번호
|
|
private int recordCountPerPage = 20; // 페이지당 레코드 수
|
|
private int pageSize = 10; // 페이지 크기
|
|
private int totalRecordCount = 0; // 전체 레코드 수
|
|
|
|
// Getters and Setters
|
|
public int getCurrentPageNo() {
|
|
return currentPageNo;
|
|
}
|
|
|
|
public void setCurrentPageNo(int currentPageNo) {
|
|
this.currentPageNo = currentPageNo;
|
|
}
|
|
|
|
public int getRecordCountPerPage() {
|
|
return recordCountPerPage;
|
|
}
|
|
|
|
public void setRecordCountPerPage(int recordCountPerPage) {
|
|
this.recordCountPerPage = recordCountPerPage;
|
|
}
|
|
|
|
public int getPageSize() {
|
|
return pageSize;
|
|
}
|
|
|
|
public void setPageSize(int pageSize) {
|
|
this.pageSize = pageSize;
|
|
}
|
|
|
|
public int getTotalRecordCount() {
|
|
return totalRecordCount;
|
|
}
|
|
|
|
public void setTotalRecordCount(int totalRecordCount) {
|
|
this.totalRecordCount = totalRecordCount;
|
|
}
|
|
|
|
// 계산된 값들
|
|
public int getTotalPageCount() {
|
|
if (totalRecordCount == 0) {
|
|
return 0;
|
|
}
|
|
return (int) Math.ceil((double) totalRecordCount / recordCountPerPage);
|
|
}
|
|
|
|
public int getFirstRecordIndex() {
|
|
return (currentPageNo - 1) * recordCountPerPage;
|
|
}
|
|
|
|
public int getLastRecordIndex() {
|
|
return currentPageNo * recordCountPerPage;
|
|
}
|
|
} |