myBatis分页插件配置

由于 Apache公司发现myBatis的分页弊端,所以又研发出得补丁:PageHelper

中央仓库5.1.2版连接地址:

<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>

设置拦截器:

    1.在myBatis核心配置文件中拦截

<plugins>
<!--分页的拦截器地址-->
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<!--
      dialect myBatis方言生成相对应的SQL语句,插件可自动识别数据库,默认连接的是mysql,mysql可省略此行
     -->
<property name="dialect" value=""></property>
    <!--
    reasonable表示分页合理化,类型为布尔类型默认为FALSE 当前默认页码为 1
    -->
     <property name="reasonable" value="ture"></property>

</plugin>
</plugins>

    2.在spring核心配置文件中拦截

原文地址:https://www.cnblogs.com/chbin/p/10235227.html