<!--MyBatis分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
PagerHelper
The MyBatis paging plug-in can realize paging with a few simple lines of code. When integrating with SpringBoot, as long as the PagerHelper is integrated, MyBatis is automatically integrated.
PageHelper.startPage(pageNum, pageSize);
//之后进行查询操作将自动进行分页
List<PmsBrand> brandList =
brandMapper.selectByExample(new PmsBrandExample());
//通过构造PageInfo对象获取分页信息,如当前页码,总页数,总条数
PageInfo<PmsBrand> pageInfo = new PageInfo<PmsBrand>(list);
The paging
interceptor under mybatis-plus can be configured in the configuration class