分页bean

本文介绍了一个名为Pagination的分页工具类,该类通过设置当前页码、每页显示的记录数量等属性来实现数据分页功能。文章详细解释了各属性的作用,并提供了关键方法的实现代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

package com.pm360.pip.util.vo;

import java.math.BigDecimal;
import java.util.List;

public class Pagination
{
 private int pageIndex=1;//当前页(默认第一页)
 private int pageCount=10;//每页显示的记录数(默认每页显示10条记录)
 private int pageBeginCount;//当前页记录数起始位置
 private int totalCount;//总记录数
 private int totalPageIndex;//总页数
 private List<Integer> pageIndexList;
 public int getPageIndex() {
  return pageIndex;
 }
 public void setPageIndex(int pageIndex) {
  this.pageIndex = pageIndex;
 }
 public int getPageCount() {
  return pageCount;
 }
 public void setPageCount(int pageCount) {
  this.pageCount = pageCount;
 }
 public int getPageBeginCount(int pageIndex,int pageCount) {
  pageBeginCount=(pageIndex-1)*pageCount;
  return pageBeginCount;
 }
 public void setPageBeginCount(int pageBeginCount) {
  this.pageBeginCount = pageBeginCount;
 }
 public int getTotalCount() {
  return totalCount;
 }
 public void setTotalCount(int totalCount) {
  this.totalCount = totalCount;
 }
 public int getTotalPageIndex() {
  return totalPageIndex;
 }
 public void setTotalPageIndex(int totalCount,int pageCount,int totalPageIndex) {
   BigDecimal bdtotalCount=new BigDecimal(totalCount);
   BigDecimal bdPageCount=new BigDecimal(pageCount);
   totalPageIndex=(int) Math.ceil((bdtotalCount.divide(bdPageCount,2)).doubleValue());
   this.totalPageIndex =  totalPageIndex;
 }
 public List<Integer> getPageIndexList() {
  return pageIndexList;
 }
 public void setPageIndexList(int totalPageIndex,List<Integer>pageIndexList) {
  for (int i = 1; i <= totalPageIndex; i++)
  {
   pageIndexList.add(i);
  }
  this.pageIndexList = pageIndexList;
 }
 
 
 

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值