package model type ProductCategory struct { TenantBase Name string `gorm:"size:100;not null" json:"name"` ParentID *uint64 `json:"parent_id"` SortOrder int `gorm:"default:0" json:"sort_order"` } type Product struct { TenantBase Code string `gorm:"size:50" json:"code"` Barcode string `gorm:"size:100" json:"barcode"` Name string `gorm:"size:200;not null" json:"name"` Series string `gorm:"size:100" json:"series"` Spec string `gorm:"size:100" json:"spec"` Unit string `gorm:"size:20" json:"unit"` CategoryID *uint64 `json:"category_id"` Brand string `gorm:"size:100" json:"brand"` PurchasePrice float64 `gorm:"type:decimal(12,2)" json:"purchase_price"` SalePrice float64 `gorm:"type:decimal(12,2)" json:"sale_price"` MinStock int `gorm:"default:0" json:"min_stock"` CustomFields JSON `gorm:"type:json" json:"custom_fields,omitempty"` Remark string `gorm:"size:500" json:"remark"` Category *ProductCategory `gorm:"foreignKey:CategoryID" json:"category,omitempty"` }