spring boot集成开源分页插件pagehelper
2018-03-09 00:00
936 查看
在实际项目中用到了开源的pagehelper,开始觉得用着还不错,但是后面数据量慢慢多了起来,还是觉得原始的分页配置limit,再查count好用,个人感觉吧。
1.pom.xml <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.2</version> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-autoconfigure</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</version> </dependency> 2.配置Mysql方言 import com.github.pagehelper.PageHelper; import java.util.Properties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class PageHelperConfig { @Bean public PageHelper getPageHelper(){ PageHelper pageHelper=new PageHelper(); Properties properties=new Properties(); properties.setProperty("helperDialect","mysql"); properties.setProperty("reasonable","true"); properties.setProperty("supportMethodsArguments","true"); properties.setProperty("params","count=countSql"); pageHelper.setProperties(properties); return pageHelper; } } 3.分页 PageHelper.startPage(当前页码, 每页数量); PageInfo info = new PageInfo<>(infoList);
相关文章推荐
- SpringBoot集成分页插件PageHelper
- spring-boot 集成mybatis的分页插件PageHelper和Generator (番外)
- spring-boot 集成mybatis的分页插件PageHelper和Generator (番外)
- SpringBoot集成MyBatis的分页插件PageHelper(回头草)
- [置顶] MyBatis基于Spring-boot集成通用Mapper以及pagehelper分页插件(含源码下载)
- springboot如何集成mybatis的pagehelper分页插件
- SpringBoot集成MyBatis的分页插件PageHelper(回头草)
- spring-boot 集成mybatis的分页插件PageHelper和Generator
- Spring Boot系列六 Spring boot集成mybatis、分页插件pagehelper
- spring boot笔记6——实现分页,spring boot集成page helper
- SpringBoot之分页插件PageHelper的使用
- springboot中分页插件pageHelper的使用
- SpringBoot Mybatis PageHelper分页插件的两种用法(二)
- 记录问题:springboot中使用Mybatis-pagehelper分页插件遇到的版本兼容问题
- spring-boot | 整合通用Mabatis 分页插件PageHelper
- Springboot +pagehelper 分页插件
- SpringBoot Mybatis PageHelper分页插件的两种用法(一)
- SpringBoot分页插件PageHelper
- SpringBoot集成Mybatis并具有分页功能PageHelper
- Spring Boot系列教程十一: Mybatis使用分页插件PageHelper