26 lines
770 B
Go
26 lines
770 B
Go
package models
|
|
|
|
import (
|
|
"git.apinb.com/bsm-sdk/core/database"
|
|
"git.apinb.com/bsm-sdk/engine/types"
|
|
)
|
|
|
|
// 云盘目录模型
|
|
type CloudDiskDir struct {
|
|
types.Std_IICUDS
|
|
types.Std_Passport
|
|
CloudBase
|
|
ParentID *uint `gorm:"index" json:"parent_id"` // 支持嵌套目录
|
|
Name string `gorm:"size:100" json:"name"` // 目录名称
|
|
Path string `gorm:"size:500" json:"path"` // 完整路径
|
|
|
|
// 自关联
|
|
Parent *CloudDiskDir `gorm:"foreignKey:ParentID" json:"parent"` // 父级目录
|
|
Subdirectories []CloudDiskDir `gorm:"foreignKey:ParentID" json:"subdirectories"` // 子级目录
|
|
Files []CloudDiskFile `gorm:"foreignKey:DirectoryID" json:"files"` // 文件
|
|
}
|
|
|
|
func init() {
|
|
database.AppendMigrate(&CloudDiskDir{})
|
|
}
|