diff --git a/backend/gradlew b/backend/gradlew old mode 100644 new mode 100755 diff --git a/backend/src/main/java/com/example/backend/search/controller/SearchController.java b/backend/src/main/java/com/example/backend/search/controller/SearchController.java index ae4810ab..a4657648 100644 --- a/backend/src/main/java/com/example/backend/search/controller/SearchController.java +++ b/backend/src/main/java/com/example/backend/search/controller/SearchController.java @@ -19,11 +19,10 @@ public class SearchController { // 로그 검색 API @GetMapping("/log") - public ResponseEntity getCheckLog(@RequestBody SearchRequest request, HttpSession session) { + public ResponseEntity getCheckLog(@ModelAttribute SearchRequest request, HttpSession session) { // 세션에서 사용자 정보 가져오기 UserResponseDto user = (UserResponseDto) session.getAttribute("user"); if (user == null) { - // 전역 예외 핸들러에서 처리할 수 있도록 예외를 던짐 throw new IllegalStateException("로그인이 필요합니다."); } int officeId = user.getOfficeId(); diff --git a/backend/src/main/java/com/example/backend/search/dto/SearchResult.java b/backend/src/main/java/com/example/backend/search/dto/SearchResult.java index c9e889fe..8d6b4e0e 100644 --- a/backend/src/main/java/com/example/backend/search/dto/SearchResult.java +++ b/backend/src/main/java/com/example/backend/search/dto/SearchResult.java @@ -9,10 +9,12 @@ public class SearchResult { private final List results; // 검색 결과 리스트 private final int totalPages; // 전체 페이지 수 + private final long totalElements; // 전체 데이터 개수 @Builder - public SearchResult(List results, int totalPages) { + public SearchResult(List results, int totalPages, long totalElements) { this.results = results; this.totalPages = totalPages; + this.totalElements = totalElements; } } diff --git a/backend/src/main/java/com/example/backend/search/service/SearchService.java b/backend/src/main/java/com/example/backend/search/service/SearchService.java index f48af248..258347bb 100644 --- a/backend/src/main/java/com/example/backend/search/service/SearchService.java +++ b/backend/src/main/java/com/example/backend/search/service/SearchService.java @@ -55,11 +55,13 @@ public SearchResult getCheckLog(String category, LocalDateTime startDate, LocalD // 전체 페이지 수 가져오기 int totalPages = casePage.getTotalPages(); + long totalElements = casePage.getTotalElements(); // 결과 반환 return SearchResult.builder() .results(results) .totalPages(totalPages) + .totalElements(totalElements) .build(); }