jiangshuai
2023-10-20 96844c22ef3fba86a55e0af1b51bc1009d6fa950
models/operation_type.go
@@ -103,6 +103,11 @@
   return slf
}
func (slf *OperationTypeSearch) SetWarehouseId(warehouseId int) *OperationTypeSearch {
   slf.WarehouseId = warehouseId
   return slf
}
func (slf *OperationTypeSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&OperationType{})
@@ -124,6 +129,10 @@
   if slf.Preload {
      db = db.Preload("Company").Preload("Warehouse").Preload("DefaultLocationSrc").Preload("DefaultLocationDest")
   }
   if slf.WarehouseId > 0 {
      db = db.Where("warehouse_id = ?", slf.WarehouseId)
   }
   return db
@@ -282,7 +291,8 @@
      records = make([]*OperationTypeByStatus, 0)
      db      = slf.Orm
   )
   db = db.Table("wms_job_type").Select("wms_job_type.id,wms_operation.status,count(wms_operation.id) as count").InnerJoins("inner join wms_operation on wms_operation.operation_type_id=wms_job_type.id").Group("wms_job_type.id,wms_operation.status")
   db = db.Table("wms_job_type").Select("wms_job_type.id,wms_operation.status,count(wms_operation.id) as count").InnerJoins("inner join wms_operation on wms_operation.operation_type_id=wms_job_type.id").Where("wms_operation.deleted_at is null").
      Group("wms_job_type.id,wms_operation.status")
   if len(idList) > 0 {
      db = db.Where("wms_job_type.id IN ?", idList)
   }