数据库中的都查询了(在这个前提下再往下看),但是后面没有跟分页条件limit
问题一:
请不要使用1.0.0版本,因为还不支持拦截器插件(如下):
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>
如下两个版本一定要对应(下面是我使用的)
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.9</version>
</dependency>
如果没办法确定这两个的版本,就都用最新的就ok
问题二:
第二种不好使的情况就是重新定义了SqlSessionFactory但是并没有配置对应的PageHelper插件,所以导致使用PageHelper.startPage(1,1);无效。
解决方法-引用其他博主的博客的解决:
https://blog.youkuaiyun.com/linxingliang/article/details/52566881