一、集成步骤
1、添加PageHelper插件依赖
2、注册分页对象PageHelper到Spring容器中
3、创建分页实体类
4、分页功能实现只需要添加 Page page= PageHelper.startPage(currentPage,PageBean.PAGE_SIZE,true);一行代码,既可自动实现分页功能。重点注意该行代码必须在业务SQL语句代码上一行。
二、实现
1、添加PageHelper插件依赖
<!-- mybatis的分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
</dependency>
2、注册分页对象PageHelper到Spring容器中
package org.cm.channelmanage.config;
import com.github.pagehelper.PageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Properties;
@Configuration
public class PageHelperConfig {
@Bean
public PageHelper pageHelper(){
Pag