作者 陈志颖

fix:查询合约限制条件

@@ -145,15 +145,18 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp @@ -145,15 +145,18 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp
145 query = query.Where(`A.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName)) 145 query = query.Where(`A.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName))
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("cooperation_contract_undertaker.company->>'companyId' = '?'", companyId)
148 query.Where("A.company->>'companyId' = '?'", companyId) 149 query.Where("A.company->>'companyId' = '?'", companyId)
149 query.Where("B.company->>'companyId' = '?'", companyId) 150 query.Where("B.company->>'companyId' = '?'", companyId)
150 } 151 }
151 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 152 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
  153 + query.Where("cooperation_contract_undertaker.org->>'orgId' = '?'", orgId)
152 query.Where("A.org->>'orgId' = '?'", orgId) 154 query.Where("A.org->>'orgId' = '?'", orgId)
153 query.Where("B.org->>'orgId' = '?'", orgId) 155 query.Where("B.org->>'orgId' = '?'", orgId)
154 } 156 }
155 if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 { 157 if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
156 newOrgIds := utils.SliceItoa(orgIds.([]int64)) 158 newOrgIds := utils.SliceItoa(orgIds.([]int64))
  159 + query.Where("cooperation_contract_undertaker.org->>'orgId' in (?)", pg.In(newOrgIds))
157 query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds)) 160 query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds))
158 query.Where("B.org->>'orgId' in (?)", pg.In(newOrgIds)) 161 query.Where("B.org->>'orgId' in (?)", pg.In(newOrgIds))
159 } 162 }