1.添加依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<!-- mybatis
集成mybatis
-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<!---mybatis plus
集成mybatis plus
-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.1</version>
</dependency>
2.配置PageHelper
@Configuration
public class MybatisPangeHelperConfig {
@Bean
public PageInterceptor pageInterceptor(){
PageInterceptor pageInterceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("reasonable","true");
pageInterceptor.setProperties(properties);
return pageInterceptor;
}
}
遇到的问题:
在mybatis-config.xml中配置分页插件,
启动类通过@ImportResource(locations = { "mybatis/mybatis-config.xml"})
方式自动装配无效,分页信息不对;
版权声明:本文为qq_29393273原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。