Study/server/model/learning/question.go

28 lines
1.5 KiB
Go

package learning
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
// Question 题目模型
type Question struct {
global.GVA_MODEL
KnowledgePointId uint `json:"knowledgePointId" form:"knowledgePointId" gorm:"column:knowledge_point_id;comment:关联知识点ID;not null;" binding:"required"`
Title string `json:"title" form:"title" gorm:"column:title;comment:题目标题;size:255;not null;" binding:"required"`
Content string `json:"content" form:"content" gorm:"column:content;comment:题目内容;type:longtext;"`
Type string `json:"type" form:"type" gorm:"column:type;comment:题目类型;size:50;not null;" binding:"required"`
Options string `json:"options" form:"options" gorm:"column:options;comment:选项内容JSON;type:text;"`
Answer string `json:"answer" form:"answer" gorm:"column:answer;comment:正确答案;type:text;not null;" binding:"required"`
Explanation string `json:"explanation" form:"explanation" gorm:"column:explanation;comment:答案解析;type:longtext;"`
Difficulty string `json:"difficulty" form:"difficulty" gorm:"column:difficulty;comment:难度等级;size:50;default:medium;"`
Score int `json:"score" form:"score" gorm:"column:score;comment:题目分值;default:5;"`
// 关联关系 - 去掉外键约束,只保留逻辑关联
KnowledgePoint KnowledgePoint `json:"knowledgePoint" gorm:"-"`
}
// TableName 设置表名
func (Question) TableName() string {
return "learning_questions"
}