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