1、pom.xml中加入依赖:

    1. <!--pagehelper分页坐标-->
    2. <dependency>
    3. <groupId>com.github.pagehelper</groupId>
    4. <artifactId>pagehelper</artifactId>
    5. <version>5.1.10</version>
    6. </dependency>

    2、在MyBatis配置文件中加入,分页插件:
    image.png

    1. <!--分页插件此处,方在 typeAliases 后面-->
    2. <plugins>
    3. <plugin interceptor="com.github.pagehelper.PageInterceptor" />
    4. </plugins>

    分页插件插入的位置(位置不对会报错,鼠标停留报错的标签上,会提示正确的位置):

    • 这里放在 <typeAliases> 标签的后面。 ```xml <?xml version=”1.0” encoding=”UTF-8” ?> <!DOCTYPE configuration

      1. PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
      2. "http://mybatis.org/dtd/mybatis-3-config.dtd">

    ```