JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

分页的时候总页数计算

发布时间 2023-12-01 10:29:37作者: 爱喝茶的安迪
if(resultData.getSuccess()){
BackDataInfo data = resultData.getData();
int totalRecords = data.getTotal();
int currentPageSize = data.getPageSize();
totalPageNumber = (int)Math.ceil(totalRecords * 1.0 /currentPageSize);
log.info("totalRecords:" + totalRecords);
log.info("currentPageSize:" + currentPageSize);
log.info("totalPageNumber:" + totalPageNumber);
}

 1. 将总条数乘以“1.0”转成小数类型

2. 调用Math.ceil向上取数转成int类型

    本栏目推荐文章
  • 为什么Cad移动块或者移动参照块的时候会很卡? 电脑配置不错,也是新的,正常画图会很流畅,就不知道为什么Cad移动块或者移动参照块的时候会很卡?
  • No appropriate protocol (protocol is disabled or cipher suites are inappropriate)衫德钱包http请求时候
  • [转]如何让asp.net core mvc发布时候不编译cshtml视图
  • 【csharp】什么时候用接口?什么时候使用类?
  • 【csharp】抽象类与接口有哪些不同?什么时候应该使用抽象类?
  • go gorm 更新的时候不会更新空字段
  • 从前做前端的时候, 联通的好多html5活动, 页面布局如何整齐,回顾一个常用的
  • 前端发送请求的时候 Content-Type 内容分类, django后端分别怎么接收
  • MySQL 啥时候用表锁,啥时候用行锁?
  • 涉及到金额的时候是,使用Decimal而不是float和double 浮点数
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们