package models // ProductCategory 商品分类表 type ProductCategory struct { ID int64 `json:"id" gorm:"primarykey;comment:分类ID"` ParentID int64 `json:"parent_id" gorm:"not null;default:0;index;comment:上级分类ID,0表示顶级"` Name string `json:"name" gorm:"size:100;not null;default:'';comment:分类名称"` SortOrder int `json:"sort_order" gorm:"not null;default:0;comment:排序"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` } func (ProductCategory) TableName() string { return "product_category" } func (ProductCategory) TableOptions() string { return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品分类表'" }