mybatisplus分页查询总页数
时间: 2023-08-27 20:06:24 浏览: 145
mybatis-plus分页查询
根据您提供的引用内容,可以使用Page对象的`getPages()`方法来获取mybatisplus分页查询的总页数。在代码中,可以通过以下方式获取总页数:
```
Page<User> pageParam = userMapper.selectPage(page, null);
int totalPages = pageParam.getPages();
```
其中,`getPages()`方法返回的是一个整数,表示总页数。您可以将其赋值给一个整型变量`totalPages`来获取总页数。请注意,`getPages()`方法是mybatisplus提供的方法,可以直接在代码中使用。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [MybatisPlus 分页查询不生效,拦截器无效的解决方案](https://blog.csdn.net/lianwen90/article/details/129603469)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Mybatis-Plus简单查询和分页](https://blog.csdn.net/chengqiuming/article/details/109694501)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Mybatisplus 分页查询时,禁止自动统计总数](https://blog.csdn.net/xiaojin21cen/article/details/129123241)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文