PageHelper
PageHelper主要是一个分页用的插件,通过该插件可以不用在sql中编写较为复杂的分页sql,通过两行代码就可以搞定
PageHelper官网首页:https://pagehelper.github.io/
官网有详细的介绍,以下属于精简版的,拿来即用
首先导入依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.2.0</version>
</dependency>
然后在MyBatis配置文件中插件
<!--
plugins在配置文件中的位置必须符合要求,否则会报错,顺序如下:
-->
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!-- config params as the following -->
<!-–分页参数合理化 –>-->
<property name="reasonable" value=&#