dt_material.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package daytask
  2. // DtMaterial 素材表
  3. type DtMaterial struct {
  4. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:素材ID"`
  5. Name string `json:"name" gorm:"column:name;type:varchar(128);not null;comment:文件名"`
  6. Path string `json:"path" gorm:"column:path;type:varchar(512);not null;comment:文件路径"`
  7. Url string `json:"url" gorm:"column:url;type:varchar(512);not null;comment:访问URL"`
  8. Content string `json:"content" gorm:"column:content;type:text;comment:文字内容(type=text时使用)"`
  9. Type string `json:"type" gorm:"column:type;type:varchar(32);not null;index:idx_type;comment:类型: image/video/audio/document/text"`
  10. MimeType string `json:"mimeType" gorm:"column:mime_type;type:varchar(128);comment:MIME类型"`
  11. Size int64 `json:"size" gorm:"column:size;type:bigint;default:0;comment:文件大小(字节)"`
  12. Width int `json:"width" gorm:"column:width;type:int;default:0;comment:宽度(图片/视频)"`
  13. Height int `json:"height" gorm:"column:height;type:int;default:0;comment:高度(图片/视频)"`
  14. Duration int `json:"duration" gorm:"column:duration;type:int;default:0;comment:时长(视频/音频,秒)"`
  15. Storage string `json:"storage" gorm:"column:storage;type:varchar(32);default:local;comment:存储: local/oss/cos"`
  16. GroupId int64 `json:"groupId" gorm:"column:group_id;type:bigint;default:0;index:idx_group_id;comment:分组ID"`
  17. AdminId int64 `json:"adminId" gorm:"column:admin_id;type:bigint;default:0;comment:上传管理员ID"`
  18. Sort int `json:"sort" gorm:"column:sort;type:int;default:0;comment:排序"`
  19. Status int `json:"status" gorm:"column:status;type:tinyint;default:1;comment:状态:1启用,0禁用"`
  20. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;comment:创建时间"`
  21. }
  22. func (*DtMaterial) TableName() string {
  23. return "dt_material"
  24. }
  25. func NewDtMaterial() *DtMaterial {
  26. return &DtMaterial{}
  27. }
  28. // DtMaterialGroup 素材分组表
  29. type DtMaterialGroup struct {
  30. Id int64 `json:"id" gorm:"column:id;type:bigint;primarykey;comment:分组ID"`
  31. Name string `json:"name" gorm:"column:name;type:varchar(64);not null;comment:分组名称"`
  32. Code string `json:"code" gorm:"column:code;type:varchar(64);comment:分组代码"`
  33. ParentId int64 `json:"parentId" gorm:"column:parent_id;type:bigint;default:0;index:idx_parent_id;comment:父级ID"`
  34. Sort int `json:"sort" gorm:"column:sort;type:int;default:0;comment:排序"`
  35. Status int `json:"status" gorm:"column:status;type:tinyint;default:1;comment:状态:1启用,0禁用"`
  36. Description string `json:"description" gorm:"column:description;type:varchar(255);comment:描述"`
  37. CreatedAt int64 `json:"createdAt" gorm:"column:created_at;type:bigint;autoCreateTime;comment:创建时间"`
  38. UpdatedAt int64 `json:"updatedAt" gorm:"column:updated_at;type:bigint;autoUpdateTime;comment:更新时间"`
  39. }
  40. func (*DtMaterialGroup) TableName() string {
  41. return "dt_material_group"
  42. }
  43. func NewDtMaterialGroup() *DtMaterialGroup {
  44. return &DtMaterialGroup{}
  45. }