jiangshuai
2023-10-20 96844c22ef3fba86a55e0af1b51bc1009d6fa950
models/location_product_amount.go
@@ -30,7 +30,7 @@
   LocationProductAmountWithOperation struct {
      //LocationProductAmount LocationProductAmount `json:"locationProductAmount"`
      LocationProductAmountId int                      `json:"locationProductAmount" gorm:"location_product_amount_id"`
      LocationProductAmountId int                      `json:"locationProductAmountId" gorm:"location_product_amount_id"`
      LocationId              int                      `json:"locationId" gorm:"column:location_id"`
      LocationName            string                   `json:"locationName" gorm:"column:location_name"`
      ProductId               string                   `json:"productId" gorm:"column:product_id"`
@@ -83,6 +83,11 @@
   return slf
}
func (slf *LocationProductAmountSearch) SetLocationProductId(id int) *LocationProductAmountSearch {
   slf.LocationProductId = id
   return slf
}
func (slf *LocationProductAmountSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&LocationProductAmount{})
@@ -100,6 +105,9 @@
   if slf.Preload {
      db = db.Model(&LocationProductAmount{}).Preload("LocationProduct").Preload("LocationProduct.Location").Preload("LocationProduct.Product")
   }
   if slf.LocationProductId != 0 {
      db = db.Where("location_product_id=?", slf.LocationProductId)
   }
   return db
}