From ead4df22dca33a867279471821ca675f91dec760 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期六, 14 五月 2022 18:44:54 +0800 Subject: [PATCH] FixIssue0514 --- force-app/main/default/classes/SearchContactController.cls | 38 ++++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 10 deletions(-) diff --git a/force-app/main/default/classes/SearchContactController.cls b/force-app/main/default/classes/SearchContactController.cls index c2f9efa..c934058 100644 --- a/force-app/main/default/classes/SearchContactController.cls +++ b/force-app/main/default/classes/SearchContactController.cls @@ -33,16 +33,28 @@ //1. Query Contact by accountId List<Contact> conList = new List<Contact>(); system.debug('Account Id from Front-end:'+accountId); - if(checkNullString(accountId)&&checkNullString(searchKeyWord)){ - conList = new List<Contact>(); - }else{ - if(checkNullString(accountId)){ - conList = new List<Contact>(); - }else { - conList = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId=:accountId and AWS_Data_Id__c!='']); - } + // if(checkNullString(accountId)&&checkNullString(searchKeyWord)){ + // conList = new List<Contact>(); + // }else{ + // if(checkNullString(accountId)){ + // conList = new List<Contact>(); + // }else { + // conList = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId=:accountId and AWS_Data_Id__c!='']); + // } - } + // } + if(String.isNotBlank(accountId) && String.isNotEmpty(accountId)){ + String accountIdStr = ''; + String[] accountIds = accountId.split(','); + List<String> accountIdList = new List<String>(); + for(String s : accountIds){ + accountIdList.add(s); + } + conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId in:accountIdList and AWS_Data_Id__c!='']); + System.debug('conList:'+conList); + } else{ + conList = new List<Contact>(); + } //2. Prepare the Contact Info Map<String,Contact> awsIdToContactMap = new Map<String,Contact>(); List<String> conAWSIds = new List<String>(); @@ -65,7 +77,13 @@ List<String> awsDataIds = (List<String>) JSON.deserialize(awsContactIds, List<String>.class); List<Contact> conListTemp = new List<Contact>(); if(!checkNullString(accountId)){ - conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId=:accountId and AWS_Data_Id__c in:awsDataIds]); + String accountIdStr = ''; + String[] accountIds = accountId.split(','); + List<String> accountIdList = new List<String>(); + for(String s : accountIds){ + accountIdList.add(s); + } + conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId in:accountIdList and AWS_Data_Id__c in:awsDataIds]); }else { conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c in:awsDataIds]); } -- Gitblit v1.9.1