作者 陈志颖

fix:合约查询

... ... @@ -146,14 +146,19 @@ func (dao *CooperationContractDao) SearchCooperationContractByUndertaker(queryOp
}
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query.Where("A.company->>'companyId' = '?'", companyId)
query.Where("B.company->>'companyId' = '?'", companyId)
}
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
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("A.org->>'orgId' in (?)", pg.In(newOrgIds))
query.Where("B.org->>'orgId' in (?)", pg.In(newOrgIds))
}
query.Where("A.deleted_at IS NULL")
query.Where("B.deleted_at IS NULL")
query.Join("JOIN cooperation_contracts AS A ON A.cooperation_contract_number = cooperation_contract_undertaker.cooperation_contract_number")
query.Join("JOIN cooperation_modes AS B ON B.cooperation_mode_number = A.cooperation_mode_number")
query = query.Order("cooperation_contract_undertaker_id DESC")
... ...