MyBatisPlus在使用分页时需要传入一个Page对象,这里对该对象做一些解释
打开Page的源码我们可以看到Page实现了IPage接口

构造函数:
同时Page中共有五个构造方法
最常用的应该是第二个构造方法
第二个构造方法是传入两个参数,第一个参数代表当前页数,第二个代表每页要展示的数据量

参数:
Page对象一共有如下10个参数:

这些参数描述如下:
| 参数名 | 参数类型 | 默认值 | 描述 |
| records |
List<T> |
用来存放查询出来的数据 | |
| total |
long |
返回记录的总数 | |
| size |
long |
10 | 每页显示条数 |
| current |
long |
1 | 当前页 |
| orders |
List<OrderItem> |
排序字段信息 | |
| optimizeCountSql |
boolean |
true | 自动优化 COUNT SQL |
| isSearchCount |
boolean |
true | 是否进行 count 查询,设置false后不会返回total |
| hitCount |
boolean |
false | 是否命中count缓存 |
| countId |
String |
暂时未知 | |
| maxLimit |
Long |
null | 单页分页条数限制 |