models/dict.go
@@ -24,6 +24,7 @@ PageSize int Orm *gorm.DB Keyword string DictTypes []constvar.DictType } ) @@ -75,6 +76,11 @@ return slf } func (slf *DictSearch) SetDictTypes(dts []constvar.DictType) *DictSearch { slf.DictTypes = dts return slf } func (slf *DictSearch) build() *gorm.DB { var db = slf.Orm.Table(slf.TableName()) @@ -103,6 +109,10 @@ db = db.Where("name like ? or number like ?", kw, kw) } if len(slf.DictTypes) > 0 { db = db.Where("dict_type in (?)", slf.DictTypes) } return db }