作者 陈志颖

fix:合约查询

@@ -146,14 +146,19 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp @@ -146,14 +146,19 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp
146 } 146 }
147 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { 147 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
148 query.Where("A.company->>'companyId' = '?'", companyId) 148 query.Where("A.company->>'companyId' = '?'", companyId)
  149 + query.Where("B.company->>'companyId' = '?'", companyId)
149 } 150 }
150 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 151 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
151 query.Where("A.org->>'orgId' = '?'", orgId) 152 query.Where("A.org->>'orgId' = '?'", orgId)
  153 + query.Where("B.org->>'orgId' = '?'", orgId)
152 } 154 }
153 if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 155 if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
154 newOrgIds := utils.SliceItoa(orgIds.([]int64)) 156 newOrgIds := utils.SliceItoa(orgIds.([]int64))
155 query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds)) 157 query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds))
  158 + query.Where("B.org->>'orgId' in (?)", pg.In(newOrgIds))
156 } 159 }
  160 + query.Where("A.deleted_at IS NULL")
  161 + query.Where("B.deleted_at IS NULL")
157 query.Join("JOIN cooperation_contracts AS A ON A.cooperation_contract_number = cooperation_contract_undertaker.cooperation_contract_number") 162 query.Join("JOIN cooperation_contracts AS A ON A.cooperation_contract_number = cooperation_contract_undertaker.cooperation_contract_number")
158 query.Join("JOIN cooperation_modes AS B ON B.cooperation_mode_number = A.cooperation_mode_number") 163 query.Join("JOIN cooperation_modes AS B ON B.cooperation_mode_number = A.cooperation_mode_number")
159 query = query.Order("cooperation_contract_undertaker_id DESC") 164 query = query.Order("cooperation_contract_undertaker_id DESC")