From 32d15a5fe2946d48a29148f828361b8fbfe65970 Mon Sep 17 00:00:00 2001 From: wangyong <2058152148@qq.com> Date: Sat, 14 Dec 2024 16:08:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8Aentity=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/lsgwr/exam/entity/Action.java | 20 ++++++++--- .../main/java/lsgwr/exam/entity/Question.java | 35 ++++++++++++++++++- .../lsgwr/exam/entity/QuestionCategory.java | 16 ++++++--- .../java/lsgwr/exam/entity/QuestionLevel.java | 14 ++++++-- .../lsgwr/exam/entity/QuestionOption.java | 13 ++++++- .../java/lsgwr/exam/entity/QuestionType.java | 15 ++++++-- .../src/main/java/lsgwr/exam/entity/Role.java | 17 +++++++++ .../src/main/java/lsgwr/exam/entity/User.java | 31 +++++++++++++++- 8 files changed, 146 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/lsgwr/exam/entity/Action.java b/backend/src/main/java/lsgwr/exam/entity/Action.java index 2c9d1df..8fb8180 100644 --- a/backend/src/main/java/lsgwr/exam/entity/Action.java +++ b/backend/src/main/java/lsgwr/exam/entity/Action.java @@ -11,17 +11,29 @@ import lombok.Data; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; - +/** + * 动作实体类 + * 它记录了操作的相关信息,包括操作ID、操作名称、操作描述以及是否默认选中 + */ @Data @Entity public class Action { + /** + * 动作ID + */ @Id @GeneratedValue private Integer actionId; - + /** + * 动作名称 + */ private String actionName; - + /** + * 动作描述 + */ private String actionDescription; - + /** + * 是否默认选中 + */ private Boolean defaultCheck; } diff --git a/backend/src/main/java/lsgwr/exam/entity/Question.java b/backend/src/main/java/lsgwr/exam/entity/Question.java index 67adf0b..d2c050a 100644 --- a/backend/src/main/java/lsgwr/exam/entity/Question.java +++ b/backend/src/main/java/lsgwr/exam/entity/Question.java @@ -14,21 +14,54 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; import javax.persistence.Id; import java.util.Date; - +/** + * 题目实体类,用于存储题目信息 + * 利用注解生成getter/setter方法 + */ @Data @Entity @DynamicUpdate public class Question { + /** + * 题目id + */ @Id private String questionId; + /** + * 题目名称 + */ private String questionName; + /** + * 题目分数 + */ private Integer questionScore; + /** + * 题目创建人id + */ private String questionCreatorId; + /** + * 题目难度id + */ private Integer questionLevelId; + /** + * 题目类型id + */ private Integer questionTypeId; + /** + * 题目分类id + */ private Integer questionCategoryId; + /** + * 题目描述 + */ private String questionDescription; + /** + * 题目选项id,用逗号隔开,例如:A,B,C,D + */ private String questionOptionIds; + /** + * 题目正确答案选项id,用逗号隔开,例如:A + */ private String questionAnswerOptionIds; /** * 创建时间, 设计表时设置了自动插入当前时间,无需在Java代码中设置了 diff --git a/backend/src/main/java/lsgwr/exam/entity/QuestionCategory.java b/backend/src/main/java/lsgwr/exam/entity/QuestionCategory.java index ca08f22..a68dfdd 100644 --- a/backend/src/main/java/lsgwr/exam/entity/QuestionCategory.java +++ b/backend/src/main/java/lsgwr/exam/entity/QuestionCategory.java @@ -13,19 +13,27 @@ import lombok.Data; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; - +/** + * 题目的类别表,从内容角度划分,比如数学、语文、英语等 + */ @Data @Entity public class QuestionCategory { - + /** + * 题目类别的id + */ @Id @GeneratedValue @JsonProperty("id") private Integer questionCategoryId; - + /** + * 题目类别的名称 + */ @JsonProperty("name") private String questionCategoryName; - + /** + * 题目类别的描述 + */ @JsonProperty("description") private String questionCategoryDescription; } diff --git a/backend/src/main/java/lsgwr/exam/entity/QuestionLevel.java b/backend/src/main/java/lsgwr/exam/entity/QuestionLevel.java index a056cbc..d0c0fcd 100644 --- a/backend/src/main/java/lsgwr/exam/entity/QuestionLevel.java +++ b/backend/src/main/java/lsgwr/exam/entity/QuestionLevel.java @@ -14,17 +14,27 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +/** + * 题目难度等级实体类,用于表示题目的难度级别信息,如难、中、易等。 + */ @Entity @Data public class QuestionLevel { + /** + * 题目难度等级ID,自增 + */ @Id @GeneratedValue @JsonProperty("id") private Integer questionLevelId; - + /** + * 题目难度等级名称,如难、中、易等 + */ @JsonProperty("name") private String questionLevelName; - + /** + * 题目难度等级描述 + */ @JsonProperty("description") private String questionLevelDescription; } diff --git a/backend/src/main/java/lsgwr/exam/entity/QuestionOption.java b/backend/src/main/java/lsgwr/exam/entity/QuestionOption.java index 3c06ef7..fc29400 100644 --- a/backend/src/main/java/lsgwr/exam/entity/QuestionOption.java +++ b/backend/src/main/java/lsgwr/exam/entity/QuestionOption.java @@ -11,12 +11,23 @@ import lombok.Data; import javax.persistence.Entity; import javax.persistence.Id; - +/** + * 问题选项实体类 + */ @Data @Entity public class QuestionOption { + /** + * 选项的编号,如A、B、C、D + */ @Id private String questionOptionId; + /** + * 选项的内容 + */ private String questionOptionContent; + /** + * 选项的描述,提供关于选项的额外解释或说明 + */ private String questionOptionDescription; } diff --git a/backend/src/main/java/lsgwr/exam/entity/QuestionType.java b/backend/src/main/java/lsgwr/exam/entity/QuestionType.java index 46a4f55..602a7b1 100644 --- a/backend/src/main/java/lsgwr/exam/entity/QuestionType.java +++ b/backend/src/main/java/lsgwr/exam/entity/QuestionType.java @@ -14,17 +14,28 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +/** + * QuestionType类代表了一个实体,用于在数据库中存储问题类型的信息。 + * 它包括问题类型的ID、名称和描述。 + */ @Data @Entity public class QuestionType { + /** + * 问题类型ID + */ @Id @GeneratedValue @JsonProperty("id") private Integer questionTypeId; - + /** + * 问题类型名称 + */ @JsonProperty("name") private String questionTypeName; - + /** + * 问题类型的描述 + */ @JsonProperty("description") private String questionTypeDescription; } diff --git a/backend/src/main/java/lsgwr/exam/entity/Role.java b/backend/src/main/java/lsgwr/exam/entity/Role.java index 31d529a..dbb7b8d 100644 --- a/backend/src/main/java/lsgwr/exam/entity/Role.java +++ b/backend/src/main/java/lsgwr/exam/entity/Role.java @@ -13,14 +13,31 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; +/** + * 角色实体类 + * 用于表示系统中的角色信息,包括角色的ID、名称、描述和详细信息等 + */ @Data @Entity public class Role { + /** + * 角色ID + * @Id标识为主键 + */ @Id @GeneratedValue private Integer roleId; + /** + * 角色名称 + */ private String roleName; + /** + * 角色描述 + */ private String roleDescription; + /** + * 角色详细信息 + */ private String roleDetail; /** * 角色所能访问的页面的主键集合(用-连接起来字符串) diff --git a/backend/src/main/java/lsgwr/exam/entity/User.java b/backend/src/main/java/lsgwr/exam/entity/User.java index 23875bc..417ce93 100644 --- a/backend/src/main/java/lsgwr/exam/entity/User.java +++ b/backend/src/main/java/lsgwr/exam/entity/User.java @@ -14,20 +14,49 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; import javax.persistence.Id; import java.util.Date; - +/** + * 用户表,记录用户信息 + */ @Data @Entity @DynamicUpdate public class User { + /** + * 用户id,主键 + */ @Id private String userId; + /** + * 用户名,唯一 + */ private String userUsername; + /** + * 昵称 + */ private String userNickname; + /** + * 密码 + */ private String userPassword; + /** + * 角色id + */ private Integer userRoleId; + /** + * 头像 + */ private String userAvatar; + /** + * 描述 + */ private String userDescription; + /** + * 邮箱 + */ private String userEmail; + /** + * 电话 + */ private String userPhone; /** * 创建时间, 设计表时设置了自动插入当前时间,无需在Java代码中设置了 -- 2.34.1