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.
23 lines
1.2 KiB
23 lines
1.2 KiB
package entities
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"sorbet/pkg/db"
|
|
"time"
|
|
)
|
|
|
|
// ResourceCategory 资源分类表
|
|
type ResourceCategory struct {
|
|
ID uint `json:"id" xml:"id" gorm:"primaryKey;not null;comment:资源分类编号"`
|
|
PID *uint `json:"pid" xml:"pid" gorm:"column:pid;comment:上级分类编号"`
|
|
Title string `json:"title" xml:"title" gorm:"size:25;not null;uniqueIndex;comment:资源分类名称"`
|
|
Sort int32 `json:"sort" xml:"sort" gorm:"default:0;comment:排序"`
|
|
Status bool `json:"status" xml:"status" gorm:"comment:状态"`
|
|
Version db.Version `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:"-" xml:"-" gorm:"comment:删除时间"`
|
|
|
|
Resources []*Resource `json:"resources" xml:"resources" gorm:"foreignKey:CategoryID"`
|
|
Children []*ResourceCategory `json:"children" xml:"children" gorm:"foreignKey:PID"`
|
|
}
|
|
|