You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.5 KiB
27 lines
1.5 KiB
1 year ago
|
package entities
|
||
|
|
||
|
import (
|
||
|
"gorm.io/gorm"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// FeatureContent 栏目内容表(文章、视频、课程)
|
||
|
type FeatureContent struct {
|
||
|
ID uint `json:"id" xml:"id" gorm:"primaryKey;not null;comment:内容编号"`
|
||
|
FeatureID uint `json:"feature_id" xml:"feature_id" gorm:"comment:所属栏目编号"`
|
||
|
CategoryID *uint `json:"category_id" xml:"category_id" gorm:"default:null;comment:所属分类编号"`
|
||
|
Type string `json:"type" xml:"type" gorm:"not null;comment:内容类型"`
|
||
|
Title string `json:"title" xml:"title" gorm:"size:100;not null;comment:内容标题"`
|
||
|
Intro string `json:"intro" xml:"intro" gorm:"size:250;comment:内容简介"`
|
||
|
Version int `json:"-" xml:"-" gorm:"comment:乐观锁"`
|
||
|
CreatedAt time.Time `json:"create_time" xml:"create_time" gorm:"<-:false;comment:创建时间"`
|
||
|
UpdatedAt time.Time `json:"update_time" xml:"update_time" gorm:"<-:false;comment:更新时间"`
|
||
|
DeletedAt gorm.DeletedAt `json:"delete_time" xml:"delete_time" gorm:"comment:删除时间"`
|
||
|
|
||
|
Chapters []*FeatureContentChapter `json:"chapters" xml:"chapters" gorm:"foreignKey:ContentID"`
|
||
|
Details []*FeatureContentDetail `json:"details" xml:"details" gorm:"foreignKey:ContentID"`
|
||
|
|
||
|
// 只有当该记录作为课程时才有效,所以这里需要 check
|
||
|
Departments []*FeatureContent `json:"departments" xml:"departments" gorm:"many2many:company_course_to_department_relations"`
|
||
|
}
|