zhangqian
2024-06-13 2f856eaa7e46c884f1cb7ad721919a086d7f34a3
models/move_history.go
@@ -19,6 +19,7 @@
      OperationTypeName string                     `json:"operationTypeName" gorm:"type:varchar(127);not null;comment:作业类型名称"` //作业类型名称
      OperationId       int                        `json:"operationId" gorm:"type:int;not null;comment:操作id"`                  //操作id
      ProductId         string                     `json:"productId" gorm:"type:varchar(255);not null;comment:产品id"`           //产品id
      Product           Material                   `json:"-" gorm:"foreignKey:ProductId"`                                      //产品
      ProductName       string                     `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"`         //产品名称
      Amount            decimal.Decimal            `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"`               //数量
      Unit              string                     `json:"unit" gorm:"type:char(10);not null;comment:单位"`                      //单位
@@ -94,6 +95,10 @@
      db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
   }
   if slf.Preload {
      db = db.Model(&MoveHistory{}).Preload("Product")
   }
   return db
}