作者 陈志颖

fix:查询合约限制条件

... ... @@ -145,15 +145,18 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp
query = query.Where(`A.cooperation_contract_sponsor->>'userName')::text LIKE ?`, fmt.Sprintf("%%%s%%", sponsorName))
}
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query.Where("cooperation_contract_undertaker.company->>'companyId' = '?'", companyId)
query.Where("A.company->>'companyId' = '?'", companyId)
query.Where("B.company->>'companyId' = '?'", companyId)
}
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("cooperation_contract_undertaker.org->>'orgId' = '?'", orgId)
query.Where("A.org->>'orgId' = '?'", orgId)
query.Where("B.org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("cooperation_contract_undertaker.org->>'orgId' in (?)", pg.In(newOrgIds))
query.Where("A.org->>'orgId' in (?)", pg.In(newOrgIds))
query.Where("B.org->>'orgId' in (?)", pg.In(newOrgIds))
}
... ...