| | |
| | | Keyword string |
| | | PageNum int |
| | | PageSize int |
| | | ProductIds []uint |
| | | } |
| | | ) |
| | | |
| | |
| | | |
| | | func (slf *SalesDetailsProductSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Model(&SalesDetailsProduct{}) |
| | | if len(slf.ProductIds) > 0 { |
| | | db = db.Where("product_id in (?)", slf.ProductIds) |
| | | } |
| | | |
| | | return db |
| | | } |
| | | |
| | | func (slf *SalesDetailsProductSearch) SetProductIds(ids []uint) *SalesDetailsProductSearch { |
| | | slf.ProductIds = ids |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesDetailsProductSearch) Create(record *SalesDetailsProduct) error { |
| | | var db = slf.build() |
| | | return db.Create(record).Error |