Commit 015812b8 authored by Nguyen Ha's avatar Nguyen Ha
parents 3356201f 5981fa8b
......@@ -173,8 +173,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query.setParameter("p_name", "%" +
requestDto.getCampaignName().trim().toUpperCase()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
.replaceAll("%", "\\%")
.replaceAll("_", "\\_")
+ "%");
}
......@@ -652,7 +652,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" +
"where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)\n";
......
......@@ -1585,16 +1585,18 @@ public class CustomerServiceImpl implements CustomerService {
sb.append("with cusPhone as (");
sb.append(" select customer_id cusId,");
sb.append(" contact phone");
sb.append(" listagg(contact, ',') within group (order by create_date desc) phone");
sb.append(" from customer_contact cc");
sb.append(" where cc.contact_type = 5");
sb.append(" and status = 1");
sb.append(" and status = 1 ");
sb.append(" group by customer_id");
sb.append(" ), cusEmail as (");
sb.append(" select customer_id cusId,");
sb.append(" contact email");
sb.append(" listagg(contact , ',') within group(order by create_date desc) email");
sb.append(" from customer_contact cc");
sb.append(" where cc.contact_type = 2");
sb.append(" and status = 1");
sb.append(" and status = 1 ");
sb.append(" group by customer_id");
sb.append(" )," +
"cusInCampaign as (" +
"select * from campaign_customer " +
......@@ -1917,16 +1919,24 @@ public class CustomerServiceImpl implements CustomerService {
sb.append("select c.customer_id customerId,");
sb.append(" C.NAME name,");
sb.append(" cc.contact mobileNumber,");
sb.append(" cc2.contact email,");
sb.append(" a.mobile mobileNumber,");
sb.append(" b.Email email,");
sb.append(" c.customer_type customerType,");
sb.append(" C.COMPANY_NAME companyName,");
sb.append(" c.current_address currentAddress,");
sb.append(" c.Description description");
sb.append(" FROM CUSTOMER C");
sb.append(" INNER JOIN CUSTOMER_contact cc ON (C.CUSTOMER_ID = Cc.customer_id " +
"and cc.status = 1 and cc.contact_type = 5)");
sb.append(" INNER JOIN CUSTOMER_contact Cc2 ON (C.CUSTOMER_ID = Cc2.customer_id and cc2.status = 1 and cc2.contact_type = 2)");
sb.append(" inner join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY ");
sb.append(" NULL) AS MOBILE");
sb.append(" FROM CUSTOMER_CONTACT WHERE CONTACT_TYPE = 5 AND STATUS = 1 GROUP BY ");
sb.append(" CUSTOMER_ID) a on c.CUSTOMER_ID = a.CUSTOMER_ID");
sb.append(" inner join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY ");
sb.append(" NULL) AS EMAIL");
sb.append(" FROM CUSTOMER_CONTACT WHERE CONTACT_TYPE = 2 AND STATUS = 1 GROUP BY ");
sb.append(" CUSTOMER_ID) b on b.CUSTOMER_ID = c.CUSTOMER_ID ");
// sb.append(" INNER JOIN CUSTOMER_contact cc ON (C.CUSTOMER_ID = Cc.customer_id " +
// "and cc.status = 1 and cc.contact_type = 5)");
// sb.append(" INNER JOIN CUSTOMER_contact Cc2 ON (C.CUSTOMER_ID = Cc2.customer_id and cc2.status = 1 and cc2.contact_type = 2)");
sb.append("inner join customize_field_object cfo on c.customer_id = cfo.object_id and cfo.status = 1");
sb.append(" AND C.STATUS = 1");
sb.append(" AND C.customer_id not in (select customer_id from campaign_customer where campaign_id = :p_campaign_id) ");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment