1. package model
    2. //type Stock struct {
    3. // BaseModel
    4. // Name string
    5. // Address string
    6. //}
    7. type Inventory struct{
    8. BaseModel
    9. Goods int32 `gorm:"type:int;index"`
    10. Stocks int32 `gorm:"type:int"`
    11. Version int32 `gorm:"type:int"` //分布式锁的乐观锁
    12. }
    13. //type InventoryHistory struct {
    14. // user int32
    15. // goods int32
    16. // nums int32
    17. // order int32
    18. // status int32 //1. 表示库存是预扣减, 幂等性, 2. 表示已经支付
    19. //}