liujiandao
2024-03-26 d3cf73c4718bc1972565277f038434a34f03907c
models/operation.go
@@ -43,10 +43,11 @@
      ReceiverPhone string `json:"receiverPhone" gorm:"type:varchar(31);comment:联系电话"`
      ReceiverAddr  string `json:"receiverAddr" gorm:"type:varchar(255);comment:收货地址"`
      LocationID   int      `json:"locationID"   gorm:"type:int;not null;comment:源位置id"`          //源位置id
      Location     Location `json:"location" gorm:"foreignkey:LocationID;references:Id"`          //源位置
      ToLocationID int      `json:"toLocationId"    gorm:"type:int;not null;comment:仓库位置id"`      //目标位置id
      ToLocation   Location `json:"toLocation"      gorm:"foreignKey:ToLocationID;references:Id"` //目标位置
      LocationID         int      `json:"locationID"   gorm:"type:int;not null;comment:源位置id"`          //源位置id
      Location           Location `json:"location" gorm:"foreignkey:LocationID;references:Id"`          //源位置
      ToLocationID       int      `json:"toLocationId"    gorm:"type:int;not null;comment:仓库位置id"`      //目标位置id
      ToLocation         Location `json:"toLocation"      gorm:"foreignKey:ToLocationID;references:Id"` //目标位置
      SalesDetailsNumber string   `gorm:"type:varchar(191);comment:销售明细编码" json:"salesDetailsNumber"`
   }
   OperationSearch struct {
@@ -136,6 +137,11 @@
   return slf
}
func (slf *OperationSearch) SetSalesDetailsNumber(salesDetailsNumber string) *OperationSearch {
   slf.SalesDetailsNumber = salesDetailsNumber
   return slf
}
func (slf *OperationSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&Operation{})
@@ -182,6 +188,10 @@
      db = db.Where("base_operation_type = ?", slf.BaseOperationType)
   }
   if slf.SalesDetailsNumber != "" {
      db = db.Where("sales_details_number = ?", slf.SalesDetailsNumber)
   }
   return db
}