Commit d633103b authored by Phạm Duy Phi's avatar Phạm Duy Phi

phipd commit

parent 538f07c9
...@@ -11,23 +11,16 @@ import java.util.List; ...@@ -11,23 +11,16 @@ import java.util.List;
public interface CustomerListMappingRepository extends JpaRepository<CustomerListMapping, Long> { public interface CustomerListMappingRepository extends JpaRepository<CustomerListMapping, Long> {
// ----------- customer ------------ // // ----------- customer ------------ //
@Query("select c from CustomerListMapping c where c.customerId in (:p_ids) and c.customerListId =:p_customer_list_id and c.companySiteId=:p_company_site_id") @Query("select c from CustomerListMapping c where c.customerId in (:p_ids) and c.customerListId =:p_customer_list_id and c.companySiteId=:p_company_site_id")
List<CustomerListMapping> findAllCustomerListMapping(@Param("p_ids") List<Long> p_ids, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id); List<CustomerListMapping> findAllCustomerListMapping(@Param("p_ids") List<Long> p_ids, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying
@Query("delete from CustomerListMapping c where c.customerId=:p_customer_id and c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerId(@Param("p_customer_id") Long p_customer_id, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying @Modifying
@Query("delete from CustomerListMapping c where c.customerId in (:p_ids) and c.customerListId =:p_customer_list_id and c.companySiteId=:p_company_site_id") @Query("delete from CustomerListMapping c where c.customerId in (:p_ids) and c.customerListId =:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerIds(@Param("p_ids") List<Long> p_ids, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id); int deleteMappingByCustomerIds(@Param("p_ids") List<Long> p_ids, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
// ----------- customer list --------------- // // ----------- customer list --------------- //
@Modifying
@Query("delete from CustomerListMapping c where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerListId(@Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying @Modifying
@Query("delete from CustomerListMapping c where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id") @Query("delete from CustomerListMapping c where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerListIds(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id); int deleteMappingByCustomerListIds(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
......
...@@ -17,14 +17,7 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long ...@@ -17,14 +17,7 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
@Query("select c from CustomerList c where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id and c.status = 1") @Query("select c from CustomerList c where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id and c.status = 1")
List<CustomerList> findAllCustomerList(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id); List<CustomerList> findAllCustomerList(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
@Modifying
@Query("update CustomerList c set c.status = 0 where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteCustomerList(@Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying @Modifying
@Query("update CustomerList c set c.status = 0 where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id") @Query("update CustomerList c set c.status = 0 where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id")
int deleteCustomerListIds(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id); int deleteCustomerListIds(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
@Query(value = "SELECT * FROM (SELECT c.*, MAX(c.CREATE_AT) OVER() AS LATEST_CREATED FROM CUSTOMER_LIST c) WHERE CREATE_AT = LATEST_CREATED AND COMPANY_SITE_ID =:p_company_site_id", nativeQuery = true)
CustomerList latestCreated(@Param("p_company_site_id") Long p_company_site_id);
} }
package com.viettel.campaign.repository.ccms_full; package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.web.dto.CustomerCustomDTO; import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CustomerDetailRequestDTO; import com.viettel.campaign.web.dto.request_dto.CustomerDetailRequestDTO;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO; import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.econtact.filter.UserSession;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.List; import java.util.List;
...@@ -12,4 +13,12 @@ public interface CustomerRepositoryCustom { ...@@ -12,4 +13,12 @@ public interface CustomerRepositoryCustom {
List<CustomerDetailRequestDTO> getCustomerDetailById(Long companySiteId, Long customerListId, Long customerId); List<CustomerDetailRequestDTO> getCustomerDetailById(Long companySiteId, Long customerListId, Long customerId);
List<CustomerCustomDTO> getAllCustomerByParams(SearchCustomerRequestDTO searchCustomerRequestDTO, Pageable pageable); List<CustomerCustomDTO> getAllCustomerByParams(SearchCustomerRequestDTO searchCustomerRequestDTO, Pageable pageable);
List<CampaignInformationDTO> getCampaignInformation(CampaignCustomerDTO campaignCustomerDTO);
List<CustomerDTO> getIndividualCustomerInfo(CampaignCustomerDTO campaignCustomerDTO);
List<CustomerListDTO> getCustomerListInfo(CampaignCustomerDTO campaignCustomerDTO);
List<CustomerDTO> getCustomizeFields(CampaignCustomerDTO campaignCustomerDTO, UserSession userSession, Pageable pageable);
} }
...@@ -523,8 +523,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -523,8 +523,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("pCampaignName", "%" + query.setParameter("pCampaignName", "%" +
campaignRequestDto.getCampaignName().toUpperCase() campaignRequestDto.getCampaignName().toUpperCase()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\\\_") .replaceAll("_", "\\_")
+ "%"); + "%");
} }
......
...@@ -35,14 +35,10 @@ public interface CustomerService { ...@@ -35,14 +35,10 @@ public interface CustomerService {
ResultDTO updateCustomerList(CustomerListDTO customerListDTO, String userName); ResultDTO updateCustomerList(CustomerListDTO customerListDTO, String userName);
ResultDTO deleteCustomerList(CustomerListDTO customerListDTO);
ResultDTO deleteCustomerListIds(CustomerRequestDTO customerRequestDTO); ResultDTO deleteCustomerListIds(CustomerRequestDTO customerRequestDTO);
ResultDTO searchCustomerList(SearchCustomerListRequestDTO searchCustomerListRequestDTO); ResultDTO searchCustomerList(SearchCustomerListRequestDTO searchCustomerListRequestDTO);
CustomerList getLatestCreated(Long companySiteId);
// ------------ customer contact ------------ // // ------------ customer contact ------------ //
ResultDTO getCustomerContact(CustomerContactDTO customer); ResultDTO getCustomerContact(CustomerContactDTO customer);
......
...@@ -107,14 +107,6 @@ public class CustomerController { ...@@ -107,14 +107,6 @@ public class CustomerController {
return customerService.updateCustomerList(customerListDTO, userSession.getUserName()); return customerService.updateCustomerList(customerListDTO, userSession.getUserName());
} }
@PostMapping("/deleteCustomerList")
@ResponseBody
public ResultDTO deleteCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO) {
ResultDTO result = new ResultDTO();
result = customerService.deleteCustomerList(customerListDTO);
return result;
}
@PostMapping("/deleteCustomerListIds") @PostMapping("/deleteCustomerListIds")
@ResponseBody @ResponseBody
public ResultDTO deleteCustomerListIds(@RequestBody @Valid CustomerRequestDTO customerRequestDTO) { public ResultDTO deleteCustomerListIds(@RequestBody @Valid CustomerRequestDTO customerRequestDTO) {
...@@ -129,14 +121,6 @@ public class CustomerController { ...@@ -129,14 +121,6 @@ public class CustomerController {
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@GetMapping("/latestCreated")
@ResponseBody
public ResponseEntity getLatestCreated(@RequestParam("companySiteId") Long companySiteId) {
ResultDTO result = new ResultDTO();
result.setData(customerService.getLatestCreated(companySiteId));
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/findCustomerContact") @PostMapping("/findCustomerContact")
@ResponseBody @ResponseBody
public ResponseEntity<ResultDTO> findAllCustomerContact(@RequestBody CustomerContactDTO customerContactDTO) { public ResponseEntity<ResultDTO> findAllCustomerContact(@RequestBody CustomerContactDTO customerContactDTO) {
......
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