springboot定义page工具类实现上下翻页,进行分页,使用thymeleaf进行页面渲染
需要的jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.3</version>
</dependency>
PageInfo工具类
package edu.hut.lh.Util;
import java.util.List;
public class PageInfo<T> {
private List<T> list;
private Integer totalnum;
private Integer totalpage;
private Integer currentpage;
private Integer pagesize = 5;
public PageInfo(Integer totalnum, Integer currentpage) {
this.totalnum = totalnum;
this.currentpage = currentpage;
if (totalnum