| | |
| | | } |
| | | SystemSetSearch struct { |
| | | SystemSet |
| | | Types []string |
| | | Orm *gorm.DB |
| | | Orm *gorm.DB |
| | | } |
| | | ) |
| | | |
| | |
| | | slf.Orm = tx |
| | | return slf |
| | | } |
| | | func (slf *SystemSetSearch) SetTypes(types []string) *SystemSetSearch { |
| | | slf.Types = types |
| | | return slf |
| | | } |
| | | func (slf *SystemSetSearch) SetName(name string) *SystemSetSearch { |
| | | slf.Name = name |
| | | return slf |
| | |
| | | func (slf *SystemSetSearch) build() *gorm.DB { |
| | | var db = slf.Orm.Table(slf.TableName()) |
| | | |
| | | if len(slf.Types) > 0 { |
| | | db = db.Where("system_type in (?)", slf.Types) |
| | | } |
| | | if slf.Name != "" { |
| | | db = db.Where("name = ?", slf.Name) |
| | | } |