@@ -12,5 +12,5 @@ public interface CustomerContactRepository extends JpaRepository<CustomerContact
@Query("FROM CustomerContact WHERE status = 1 AND customerId = :customerId AND contactType = :contactType AND (contact IS NULL OR UPPER(contact) LIKE UPPER(concat('%', :contact, '%')))")
" and a.customer_id not in (select cc.customer_id from campaign_customer cc where cc.campaign_id = :p_campaign_id and cc.customer_list_id = :p_customer_list_id)",nativeQuery=true)
" and a.customer_id not in (select cc.customer_id from campaign_customer cc where cc.campaign_id = :p_campaign_id and cc.customer_list_id = :p_customer_list_id and cc.in_campaign_status <> 0)",nativeQuery=true)
@@ -619,12 +621,12 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
"),\n"+
"campaign_customer_table as (\n"+
" select count(a.customer_id) campaignCustomer, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n"+
" where a.campaign_id = :p_campaign_id\n"+
" where a.campaign_id = :p_campaign_id and in_campaign_status = 1\n"+
" group by a.customer_list_id, a.campaign_id\n"+
"),\n"+
"customer_interactive_table as (\n"+
" select count(a.customer_id) campaignCustomerCalled, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n"+
" where a.status <> 0 and a.campaign_id = :p_campaign_id\n"+
" where a.status <> 0 and a.campaign_id = :p_campaign_id and in_campaign_status = 1\n"+
" group by a.customer_list_id, a.campaign_id\n"+
"),\n"+
"customer_not_interactive_table as (\n"+
...
...
@@ -652,7 +654,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
"where a.totalCusCampaign > 0"+
"),\n"+
"count_data as (\n"+
"select count(*) totalRow from data_temp\n"+
"select count(*) totalRow from data\n"+
")\n"+
"select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusCampaign, a.totalCusCalled, a.totalCusNotInteract, totalRow from data a, count_data\n"+
if(campaignCustomerRepository.findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(campaignId,companySiteId,listCustomerToAdd.get(j).getCustomerId())!=null){// Khach hang đã đc chèn vào campaign theo individual