| | |
| | | //MaterialTypes []constvar.MaterialType |
| | | Keyword string |
| | | //SetTemplateType constvar.SetTemplateType |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Ids []string |
| | | Orm *gorm.DB |
| | | Order string |
| | | PageNum int |
| | | PageSize int |
| | | Ids []string |
| | | Orm *gorm.DB |
| | | CategoryIds []int |
| | | } |
| | | |
| | | IdAndName struct { |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *MaterialSearch) SetCategoryIds(ids []int) *MaterialSearch { |
| | | slf.CategoryIds = ids |
| | | return slf |
| | | } |
| | | |
| | | // |
| | | //func (slf *MaterialSearch) SetSetTemplateType(setType constvar.SetTemplateType) *MaterialSearch { |
| | | // slf.SetTemplateType = setType |
| | |
| | | if slf.CategoryId > 0 { |
| | | db = db.Where("category_id = ?", slf.CategoryId) |
| | | } |
| | | if len(slf.CategoryIds) > 0 { |
| | | db = db.Where("category_id in ?", slf.CategoryIds) |
| | | } |
| | | |
| | | return db |
| | | } |