<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.2.0</version>
</dependency>
在核心配置文件配置分页插件
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!--分页合理化参数,默认值为false。当该参数设置为 true 时,pageNum<=0 时会查询第一页,
pageNum>pages(超过总数时),会查询最后一页。默认false 时,直接根据参数进行查询。-->
<property name="reasonable" value="true"/>
</plugin>
</plugins>
对分页进行测试
关于PageHelper分页的位置
如果要分页,他必须放在查询语句的前面,否则会出现下列这种情况,我们以为他分页了,其实并没有分页。