buli
2022-05-14 ead4df22dca33a867279471821ca675f91dec760
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]);
            }