| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package models
- // 试卷表
- type ExamPaper struct {
- ExamName string `gorm:"type:varchar(100);not null;comment:试卷名称" json:"exam_name"`
- ExamType string `gorm:"type:varchar(50);not null;comment:试卷类型" json:"exam_type"`
- TotalScore int `gorm:"type:int;not null;comment:试卷总分" json:"total_score"`
- TotalQuestions int `gorm:"type:int;not null;comment:总题数" json:"total_questions"`
- GenerationMethod string `gorm:"type:varchar(20);not null;comment:生成方式" json:"generation_method"`
- GenerationTime string `gorm:"type:varchar(50);not null;comment:生成时间" json:"generation_time"`
- UserID *uint `gorm:"type:bigint;comment:用户ID" json:"user_id"`
- Status int8 `gorm:"type:tinyint;default:1;comment:状态" json:"status"`
- BaseModel
- // 关联字段
- QuestionConfigs []ExamQuestionConfig `gorm:"foreignKey:ExamPapersID" json:"question_configs"`
- Questions []ExamQuestion `gorm:"foreignKey:ExamPapersID" json:"questions"`
- }
- // 题型配置表
- type ExamQuestionConfig struct {
- ExamPapersID uint `gorm:"type:bigint;not null;comment:试卷ID" json:"exam_papers_id"`
- QuestionType string `gorm:"type:varchar(20);not null;comment:题型" json:"question_type"`
- ScorePerQuestion int `gorm:"type:int;not null;comment:每题分值" json:"score_per_question"`
- TotalScore int `gorm:"type:int;not null;comment:该题型总分" json:"total_score"`
- QuestionCount int `gorm:"type:int;not null;comment:题目数量" json:"question_count"`
- BaseModel
- }
- // 题目表
- type ExamQuestion struct {
- ExamPapersID uint `gorm:"type:bigint;not null;comment:试卷ID" json:"exam_papers_id"`
- QuestionType string `gorm:"type:varchar(20);not null;comment:题型" json:"question_type"`
- QuestionIndex int `gorm:"type:int;not null;comment:题目序号" json:"question_index"`
- QuestionText string `gorm:"type:text;not null;comment:题目内容" json:"question_text"`
- Options []byte `gorm:"type:json;comment:选项" json:"options"`
- CorrectAnswer string `gorm:"type:varchar(50);comment:正确答案" json:"correct_answer"`
- CorrectAnswers []byte `gorm:"type:json;comment:正确答案(多选题)" json:"correct_answers"`
- AnswerOutline []byte `gorm:"type:json;comment:答题要点" json:"answer_outline"`
- BaseModel
- }
- // 用户答案表
- type ExamUserAnswer struct {
- ExamPapersID uint `gorm:"type:bigint;not null;comment:试卷ID" json:"exam_papers_id"`
- UserID uint `gorm:"type:bigint;not null;comment:用户ID" json:"user_id"`
- ExamQuestionsID uint `gorm:"type:bigint;not null;comment:题目ID" json:"exam_questions_id"`
- UserAnswer string `gorm:"type:varchar(50);comment:用户答案" json:"user_answer"`
- UserAnswers []byte `gorm:"type:json;comment:用户答案(多选题)" json:"user_answers"`
- IsCorrect *int8 `gorm:"type:tinyint;comment:是否正确" json:"is_correct"`
- }
|