yinbentan
2024-06-29 23663116574fa8f977c1241f98347833a2c28087
models/operation.go
@@ -63,7 +63,7 @@
      WarehouseId         int      `json:"warehouseId" gorm:"type:int;not null;comment:仓库id"`
      IsInternalOutput    bool     `json:"isInternalOutput"` //是否调拨产生的出库
      InventoryDealerType int      `json:"inventoryDealerType" gorm:"type:varchar(255);comment:会计名称"`
      InventoryDealerType int      `json:"inventoryDealerType" gorm:"type:varchar(255);comment:调拨出入库分类(对应dict字典表的ID)"`
      InventoryDealer     MiniDict `json:"inventoryDealer" gorm:"foreignKey:InventoryDealerType;"`
   }
@@ -82,6 +82,7 @@
      Fields              string
      BeginTime           time.Time
      EndTime             time.Time
      InventoryDealerTypeIds []int //
   }
)
@@ -189,6 +190,11 @@
   return slf
}
func (slf *OperationSearch) SetInventoryDealerTypeIds(inventoryDealerTypeArr []int) *OperationSearch {
   slf.InventoryDealerTypeIds = inventoryDealerTypeArr
   return slf
}
func (slf *OperationSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&Operation{})
@@ -258,6 +264,11 @@
   if !slf.BeginTime.IsZero() && !slf.EndTime.IsZero() {
      db = db.Where("created_at between ? and ?", slf.BeginTime, slf.EndTime)
   }
   if len(slf.InventoryDealerTypeIds) > 0 {
      db = db.Where("inventory_dealer_type in (?)", slf.InventoryDealerTypeIds)
   }
   return db
}