2026-07-03 15:58:29 +08:00
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
// Folder 文件夹模型
|
|
|
|
|
// 使用物化路径(materialized path)实现树形结构
|
|
|
|
|
// 例如: /0/1/5/ 表示根目录下ID=1的文件夹中的ID=5的文件夹
|
|
|
|
|
type Folder struct {
|
2026-07-10 17:33:33 +08:00
|
|
|
ID uint64 `json:"id" gorm:"primaryKey"`
|
|
|
|
|
BizID string `json:"biz_id" gorm:"index;size:128"` // 业务ID, 用于外部系统关联
|
2026-07-03 15:58:29 +08:00
|
|
|
Name string `json:"name" gorm:"size:256;not null"`
|
|
|
|
|
ParentID uint64 `json:"parent_id" gorm:"index;default:0"` // 0=根目录
|
|
|
|
|
OwnerID uint64 `json:"owner_id" gorm:"index;not null"`
|
|
|
|
|
Path string `json:"path" gorm:"size:1024;not null"` // 物化路径
|
|
|
|
|
Status int8 `json:"status" gorm:"default:1"` // 1=正常 0=回收站
|
|
|
|
|
Version int `json:"version" gorm:"default:1"` // 乐观锁版本号
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TableName 指定表名
|
|
|
|
|
func (Folder) TableName() string {
|
|
|
|
|
return "fs_folder"
|
|
|
|
|
}
|