20 lines
1020 B
Go
20 lines
1020 B
Go
package models
|
||
|
||
// ProductUnitConversion 商品单位换算表
|
||
type ProductUnitConversion struct {
|
||
ID int64 `json:"id" gorm:"primarykey;comment:自增ID"`
|
||
ProductID int64 `json:"product_id" gorm:"not null;uniqueIndex:uk_product_unit;comment:商品ID"`
|
||
FromUnit string `json:"from_unit" gorm:"size:20;not null;default:'';uniqueIndex:uk_product_unit;comment:源单位"`
|
||
ToUnit string `json:"to_unit" gorm:"size:20;not null;default:'';uniqueIndex:uk_product_unit;comment:目标单位"`
|
||
ConversionRate int64 `json:"conversion_rate" gorm:"not null;comment:换算率(放大10000倍的整数,如1箱=12个,则存120000)"`
|
||
IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"`
|
||
}
|
||
|
||
func (ProductUnitConversion) TableName() string {
|
||
return "product_unit_conversion"
|
||
}
|
||
|
||
func (ProductUnitConversion) TableOptions() string {
|
||
return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品单位换算表'"
|
||
}
|