1. 引入依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
2. 实现类
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.LinkedList;
import java.util.List;
/**
* @Description 分页工具类
* @Author ljchen
* @CreationDate 2021/09/28
* @Version 1.0
**/
public class PageUtils {
public static Integer defaultCurrentPage = 1;
public static Integer defaultPageSize = 10;
public static <E> Page<E> startPage(Integer currentPage, Integer pageSize) {
if (currentPage == null) {
currentPage = defaultCurrentPage;
}
if (pageSize == null) {
pageSize = defaultPageSize;
}
re