33 lines
1.8 KiB
Go
33 lines
1.8 KiB
Go
package learning
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
)
|
|
|
|
// Exam 考试模型
|
|
type Exam struct {
|
|
global.GVA_MODEL
|
|
Title string `json:"title" form:"title" gorm:"column:title;comment:考试标题;size:255;not null;" binding:"required"`
|
|
Description string `json:"description" form:"description" gorm:"column:description;comment:考试描述;type:longtext;"`
|
|
CourseId uint `json:"courseId" form:"courseId" gorm:"column:course_id;comment:关联课程ID;"`
|
|
Duration int `json:"duration" form:"duration" gorm:"column:duration;comment:考试时长(分钟);not null;" binding:"required"`
|
|
TotalScore int `json:"totalScore" form:"totalScore" gorm:"column:total_score;comment:总分;not null;" binding:"required"`
|
|
PassScore int `json:"passScore" form:"passScore" gorm:"column:pass_score;comment:及格分数;not null;" binding:"required"`
|
|
QuestionCount int `json:"questionCount" form:"questionCount" gorm:"column:question_count;comment:题目数量;not null;" binding:"required"`
|
|
StartTime time.Time `json:"startTime" form:"startTime" gorm:"column:start_time;comment:开始时间;"`
|
|
EndTime time.Time `json:"endTime" form:"endTime" gorm:"column:end_time;comment:结束时间;"`
|
|
Status string `json:"status" form:"status" gorm:"column:status;comment:考试状态;size:50;default:draft;"`
|
|
AllowRetake bool `json:"allowRetake" form:"allowRetake" gorm:"column:allow_retake;comment:是否允许重考;default:false;"`
|
|
MaxAttempts int `json:"maxAttempts" form:"maxAttempts" gorm:"column:max_attempts;comment:最大尝试次数;default:1;"`
|
|
|
|
// 关联关系 - 去掉外键约束,只保留逻辑关联
|
|
Course Course `json:"course" gorm:"-"`
|
|
}
|
|
|
|
// TableName 设置表名
|
|
func (Exam) TableName() string {
|
|
return "learning_exams"
|
|
}
|