계약일 역순 정렬 다시 적용.

This commit is contained in:
Hyojin Ahn 2026-06-24 10:42:25 -04:00
parent fcbab196cb
commit b777217d1f
2 changed files with 4 additions and 1 deletions

View File

@ -30,6 +30,9 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
// 오늘 추가된 고객 : cus_contract_date = 오늘 // 오늘 추가된 고객 : cus_contract_date = 오늘
long countByCusContractDate(LocalDate cusContractDate); long countByCusContractDate(LocalDate cusContractDate);
@Query(value = "select c from Customer c order by c.cusContractDate desc nulls last", countQuery = "select count(c) from Customer c")
Page<Customer> findAllOrderByContractDateDesc(Pageable pageable);
// 날짜별 활성 + 일별 신규/해지 "현재 기준 역산(reverse-calc)" 모델. // 날짜별 활성 + 일별 신규/해지 "현재 기준 역산(reverse-calc)" 모델.
// - 기준점: 오늘 활성 = cus_status='A' (신뢰 기준, 카드와 동일) // - 기준점: 오늘 활성 = cus_status='A' (신뢰 기준, 카드와 동일)
// - 과거 D의 활성 = 오늘 활성 (D 이후 신규 계약) + (D 이후 해지) // - 과거 D의 활성 = 오늘 활성 (D 이후 신규 계약) + (D 이후 해지)

View File

@ -87,7 +87,7 @@ public class CustomerService {
public Page<CustomerResponseDto> getAllCustomers(int page, int size) { public Page<CustomerResponseDto> getAllCustomers(int page, int size) {
Pageable pageable = PageRequest.of(page, size); Pageable pageable = PageRequest.of(page, size);
Page<Customer> customers = customerRepository.findAll(pageable); Page<Customer> customers = customerRepository.findAllOrderByContractDateDesc(pageable);
return customers.map(this::mapToDto); // 기존 mapToDto 사용 return customers.map(this::mapToDto); // 기존 mapToDto 사용
} }