4.在resource目录下创建application.yml文件
用户名、密码、端口号可以改成自己的。
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
username: root
password: laomilaomilaomi
url: jdbc:mysql://localhost:3399/selldata?serverTimezone=UTC&characterEncoding=utf-8&useSSL=false
jpa:
show-sql: true
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
//类目
@Entity //表明是一个实体类
public class ProductCategory {
@Id //主键
@GeneratedValue(strategy = GenerationType.IDENTITY)//配置主键自增长
private Integer categoryId;//类目id