分页的时候总页数计算
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类型

浙公网安备 33010602011771号