springboot实现分页插件
2020-08-15 14:32
423 查看
Spring Boot 集成 MyBatis, 分页插件 PageHelper, 通用 Mapper
1:添加pom文件依赖
<!--mybatis--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.1</version> </dependency> <!--mapper--> <dependency> <groupId>tk.mybatis</groupId> <artifactId>mapper-spring-boot-starter</artifactId> <version>1.2.4</version> </dependency> <!--pagehelper--> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</version> </dependency>
2.配置application.yml
分页配置
mybatis: type-aliases-package: tk.mybatis.springboot.model mapper-locations: classpath:mapper/*.xml mapper: mappers: - tk.mybatis.springboot.util.MyMapper not-empty: false identity: MYSQL pagehelper: helperDialect: mysql reasonable: true supportMethodsArguments: true params: count=countSql
3:代码使用
PageHelper.startPage(pageNum, pageSize); List list= service.getList(); PageInfo pageInfo= new PageInfo<>(list);
SpringBoot实现PageHelper分页插件
项目依赖
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>1.2.3</version> </dependency>
配置核心类
@Configuration @MapperScan("com.example.demo.mapper") public class MyBatisConfig { //配置PageHelper分页插件核心类 @Bean public PaginationInterceptor paginationInterceptor(){ return new PaginationInterceptor(); } }
yml配置
pagehelper: helper-dialect: mysql reasonable: true support-methods-arguments: true params: count=countSql
相关文章推荐
- 使用springboot实现通用mapper和分页插件PageHelper
- SpringBoot利用pagehelper插件实现分页
- Jquery插件实现分页查询
- springboot实现任务调度的第三种方式------使用第三方quartz插件调度(springBoot+quartz+cronTrigger进行任务调度)
- 使用PageHelper和Pagination插件实现分页
- Spring Boot 利用Pageable插件实现分页和查询
- jquery pagination插件实现无刷新分页代码
- MyBatis代码实例系列-10:MyBatis通过PageHelper插件实现分页查询
- php + jquery ui插件 + jquery pager插件 实现新闻的 标签分类 + 无刷新分页
- 基于Mybatis分页插件PageHelper实现分页功能
- jQuery插件jPaginate实现无刷新分页
- SpringBoot 使用Mybatis分页插件实现详解
- MyBatis+Mysql实现分页插件PageInfo
- MyBatis Generator实现分页插件
- MyBatis Generator实现分页插件
- Mybatis分页插件PageHelper实现自动分页
- 基于springBoot+DataTables插件的分页实现
- 使用PageHelper插件实现分页功能
- java分页的实现,插件PageHelper的使用及原理
- SpringBoot集成Mybatis分页插件PageHelper