Study/server/model/learning/knowledge_point.go

27 lines
1.3 KiB
Go

package learning
import (
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
// KnowledgePoint 知识点模型
type KnowledgePoint struct {
global.GVA_MODEL
ChapterId uint `json:"chapterId" form:"chapterId" gorm:"column:chapter_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;"`
VideoUrl string `json:"videoUrl" form:"videoUrl" gorm:"column:video_url;comment:视频链接;size:500;"`
Attachments string `json:"attachments" form:"attachments" gorm:"column:attachments;comment:附件信息JSON;type:text;"`
Sort int `json:"sort" form:"sort" gorm:"column:sort;comment:排序号;default:0;"`
Duration int `json:"duration" form:"duration" gorm:"column:duration;comment:预计学习时长(分钟);default:0;"`
Status string `json:"status" form:"status" gorm:"column:status;comment:知识点状态;size:50;default:draft;"`
// 关联关系 - 去掉外键约束,只保留逻辑关联
Chapter Chapter `json:"chapter" gorm:"-"`
}
// TableName 设置表名
func (KnowledgePoint) TableName() string {
return "learning_knowledge_points"
}