Commit bd579f71 authored by Vu Duy Anh's avatar Vu Duy Anh

anhvd commit multidatasource

parents 96185e71 e065770c
......@@ -75,6 +75,7 @@ public class Campaign implements Serializable {
private String dayOfWeek;
@Column(name = "CURRENT_TIME_MODE")
private Long currentTimeMode;
private Long currentTimeModel;
@Column(name = "WRAPUP_TIME_CONNECT")
private Long wrapupTimeConnect;
@Column(name = "WRAPUP_TIME_DISCONNECT")
......
......@@ -22,6 +22,6 @@ public interface CustomerListRepository extends JpaRepository<CustomerList, Long
@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);
@Query(value = "SELECT * FROM (SELECT c.*, MAX(c.CREATE_AT) OVER() AS LATEST_CREATED FROM CUSTOMER_LIST c) WHERE CREATE_AT = LATEST_CREATED", nativeQuery = true)
CustomerList latestCreated();
@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);
}
......@@ -36,7 +36,7 @@ public interface CustomerService {
ResultDTO searchCustomerList(SearchCustomerRequestDTO searchCustomerRequestDTO);
CustomerList getLatestCreated();
CustomerList getLatestCreated(Long companySiteId);
// ------------ customer contact ------------ //
......
......@@ -613,8 +613,8 @@ public class CustomerServiceImpl implements CustomerService {
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public CustomerList getLatestCreated() {
return customerListRepository.latestCreated();
public CustomerList getLatestCreated(Long companySiteId) {
return customerListRepository.latestCreated(companySiteId);
}
@Override
......
......@@ -53,7 +53,7 @@ public class CustomerController {
@GetMapping("/searchAllCustomerByParams")
@ResponseBody
public ResponseEntity findAllCustomerName(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort, @RequestParam("customerListId") Long customerListId, @RequestParam("companySiteId") Long companySiteId, @RequestParam("name") String name, @RequestParam("mobileNumber") String mobileNumber, @RequestParam("email") String email) {
public ResponseEntity findAllCustomerByParams(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort, @RequestParam("customerListId") Long customerListId, @RequestParam("companySiteId") Long companySiteId, @RequestParam("name") String name, @RequestParam("mobileNumber") String mobileNumber, @RequestParam("email") String email) {
ResultDTO result = customerService.searchAllCustomer(page, pageSize, sort, customerListId, companySiteId, name, mobileNumber, email);
return new ResponseEntity(result, HttpStatus.OK);
}
......@@ -166,9 +166,9 @@ public class CustomerController {
@GetMapping("/latestCreated")
@ResponseBody
public ResponseEntity getLatestCreated() {
public ResponseEntity getLatestCreated(@RequestParam("companySiteId") Long companySiteId) {
ResultDTO result = new ResultDTO();
result.setData(customerService.getLatestCreated());
result.setData(customerService.getLatestCreated(companySiteId));
return new ResponseEntity<>(result, HttpStatus.OK);
}
......
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