package models import ( "time" ) // SystemFile 附件表 yz_system_files // // 归属语义(2026-09-09 文件存储分层改造后明确): // - tid : 租户 ID // - uid : 上传者 ID // - tuid : 归属用户 ID(scope=user 时必填;scope=tenant 时为 NULL) // - source: 来源端 backend / platform // - scope : tenant-租户共享 / user-用户个人 // - object_key: 存储相对路径,不含域名,如 backend/234573/67091493/2026/09/09/xxx.png type SystemFile struct { ID uint64 `orm:"column(id);pk;auto" json:"id"` Tid uint64 `orm:"column(tid)" json:"tid"` Uid *uint64 `orm:"column(uid);null" json:"uid"` Tuid *uint64 `orm:"column(tuid);null" json:"tuid"` Name string `orm:"column(name);size(255)" json:"name"` Type uint8 `orm:"column(type);default(2)" json:"type"` Cate uint64 `orm:"column(cate);default(0)" json:"cate"` Size uint64 `orm:"column(size);default(0)" json:"size"` Src string `orm:"column(src);size(512)" json:"src"` Uploader uint64 `orm:"column(uploader);default(0)" json:"uploader"` Md5 string `orm:"column(md5);size(32)" json:"md5"` Source string `orm:"column(source);size(16);default(backend)" json:"source"` Scope string `orm:"column(scope);size(16);default(tenant)" json:"scope"` Storage string `orm:"column(storage);size(16);default()" json:"storage"` ObjectKey string `orm:"column(object_key);size(512);default()" json:"object_key"` CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"` UpdateTime *time.Time `orm:"column(update_time);type(datetime);null;auto_now" json:"update_time"` DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"` } func (m *SystemFile) TableName() string { return "yz_system_files" } // 归属与存储字段的取值常量 const ( FileSourceBackend = "backend" // 租户后台端 FileSourcePlatform = "platform" // 平台端 FileScopeTenant = "tenant" // 租户共享文件 FileScopeUser = "user" // 用户个人文件 )