| | |
| | | |
| | | LocationProductAmountSearch struct { |
| | | LocationProductAmount |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Keyword string |
| | | Orm *gorm.DB |
| | | Preload bool |
| | | LocationProductIds []int |
| | | } |
| | | |
| | | LocationProductAmountWithOperation struct { |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationProductAmountSearch) SetLocationProductIds(ids []int) *LocationProductAmountSearch { |
| | | slf.LocationProductIds = ids |
| | | return slf |
| | | } |
| | | |
| | | func (slf *LocationProductAmountSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&LocationProductAmount{}) |
| | | |
| | |
| | | if slf.LocationProductId != 0 { |
| | | db = db.Where("location_product_id=?", slf.LocationProductId) |
| | | } |
| | | if len(slf.LocationProductIds) > 0 { |
| | | db = db.Where("location_product_id in (?)", slf.LocationProductIds) |
| | | } |
| | | |
| | | return db |
| | | } |