| | |
| | | // ServiceOrderSearch 服务单搜索条件 |
| | | ServiceOrderSearch struct { |
| | | ServiceOrder |
| | | Orm *gorm.DB |
| | | QueryClass constvar.ServiceOrderQueryClass |
| | | KeywordType constvar.ServiceOrderKeywordType |
| | | Keyword string |
| | | PageNum int |
| | | PageSize int |
| | | Preload bool |
| | | Orm *gorm.DB |
| | | QueryClass constvar.ServiceOrderQueryClass |
| | | KeywordType constvar.ServiceOrderKeywordType |
| | | Keyword string |
| | | PageNum int |
| | | PageSize int |
| | | Preload bool |
| | | ServiceManIds []int |
| | | } |
| | | ) |
| | | |
| | |
| | | db = db.Joins("ServiceType", clause.LeftJoin).Where("ServiceType.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.ServiceOrderKeywordFaultType: |
| | | db = db.Joins("FaultType", clause.LeftJoin).Where("FaultType.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | } |
| | | |
| | | if len(slf.ServiceManIds) > 0 { |
| | | db = db.Where("service_man_id in ?", slf.ServiceManIds) |
| | | } |
| | | |
| | | return db |
| | |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceOrderSearch) SetMemberIds(memberIds []int) *ServiceOrderSearch { |
| | | slf.ServiceManIds = memberIds |
| | | return slf |
| | | } |
| | | |
| | | func (slf *ServiceOrderSearch) SetPreload(preload bool) *ServiceOrderSearch { |
| | | slf.Preload = preload |
| | | return slf |