From 748310cd3f64775425bd483b183bfe8a9270902d Mon Sep 17 00:00:00 2001 From: wjq <2214521312@qq.com> Date: Sun, 22 Dec 2024 12:10:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=98=E5=B7=A5=E7=AE=A1=E7=90=86=E5=AE=9E?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/api/model/entity/Employee.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 IDEA/src/main/java/com/example/api/model/entity/Employee.java diff --git a/IDEA/src/main/java/com/example/api/model/entity/Employee.java b/IDEA/src/main/java/com/example/api/model/entity/Employee.java new file mode 100644 index 00000000..66fbee37 --- /dev/null +++ b/IDEA/src/main/java/com/example/api/model/entity/Employee.java @@ -0,0 +1,57 @@ +package com.example.api.model.entity; + +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.GenericGenerator; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +/** + * 员工实体类,用于表示数据库中的员工信息表。 + */ +// @Data注解自动生成getter和setter方法,以及toString(), equals()和hashCode()方法 +@Data +// @Entity注解标记这个类是一个JPA实体,可以被持久化到数据库 +@Entity +// @NoArgsConstructor注解生成一个无参数的构造函数 +@NoArgsConstructor +public class Employee { + + /** + * id字段,用于存储员工的唯一标识符。 + * 使用@Id注解标记为主键。 + * 使用@GeneratedValue注解和@GenericGenerator注解结合使用, + * 指定使用"uuid2"生成器,该生成器使用UUID作为主键的生成策略。 + */ + @Id + @GeneratedValue(generator = "uuid2") + @GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator") + private String id; + + // 员工的名字 + private String name; + + // 员工的性别 + private String gender; + + // 员工的手机号 + private String phone; + + // 员工的家庭住址 + private String address; + + // 员工的身份证号码 + private String idCard; + + // 员工所属的部门 + private String department; + + // 员工记录的创建时间 + private String createAt; + + // 员工记录的更新时间 + private String updateAt; + +} \ No newline at end of file