/** * Copyright 2015-2025 FLY的狐狸(email:jflyfox@sina.com qq:369191470). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.jflyfox.jfinal.base; import com.jflyfox.util.Constants; public class Paginator { private int pageNo; private int pageSize; private int totalRecords; public Paginator() { this.pageNo = 1; this.pageSize = Constants.DEFAULT_PAGE_SIZE; } public Paginator(int pageNo, int pageSize) { this.pageNo = pageNo; this.pageSize = pageSize; } public int getPageNo() { return pageNo; } public void setPageNo(int pageNo) { this.pageNo = pageNo; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalRecords() { return totalRecords; } public void setTotalRecords(int totalRecords) { this.totalRecords = totalRecords; } public int getFirstResult() { if (pageNo <= 0) { return 0; } return (pageNo - 1) * pageSize; } public int getMaxResults() { return pageSize; } }