| | |
| | | |
| | | ServiceContractSearch struct { |
| | | ServiceContract |
| | | |
| | | Orm *gorm.DB |
| | | QueryClass constvar.ServiceContractQueryClass |
| | | KeywordType constvar.ServiceContractKeywordType |
| | |
| | | db = db.Joins("left join service_contract_status on service_contract_status.id = service_contract.service_contract_status_id") |
| | | db = db.Where("service_contract_status.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.ServiceContractKeywordPrincipal: |
| | | db = db.Joins("left join user on user.id = service_contract.member_id") |
| | | db = db.Where("user.username like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | db = db.Joins("left join user on user.id = service_contract.member_id").Where("user.username like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.ServiceContractKeywordProductName: |
| | | //db = db.Joins("ServiceContractProduct", clause.LeftJoin).Joins("Product", clause.LeftJoin).Where("Product.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) todo |
| | | db = db.Joins("Products", clause.LeftJoin).Where("Products.name like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | case constvar.ServiceContractKeywordServiceBeginDate: |
| | | db = db.Where("start_time = ?", slf.Keyword) |
| | | case constvar.ServiceContractKeywordServiceEndDate: |