SpringBoot+JPA分页
1.前期准备
1.新建springboot项目
2.在pom文件中导入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.2.3</version>
</dependency>
3.准备实体类 Student
/**
*实体类
*/
@Entity
@Table(name = "t_blog")
public class Student {
@Id //主键
@GeneratedValue //自增长
private long studentNo;
private String loginPwd;
private String studentName;
private String sex;
private long gradeId;
private String phone;
private String address;
private java.sql.Timestamp bornDate;
private String email;
private String identityCard;
public Student(String loginPwd, String studentName, String sex, long gradeId, String phone, String address, Timestamp bornDate, String email, String identityCard) {
this.loginPwd = loginPwd;
this.studentName = studentName;
this.sex = sex;
this.gradeId = gradeId;
this.phone = phone;
this.address = address;
this.bornDate = bornDate;
this.email = email;
this.identityCard = identityCard;
}
public Student() {
}