diff --git a/src/main/java/kr/kernel/teachme/common/aop/LogAspect.java b/src/main/java/kr/kernel/teachme/common/aop/LogAspect.java index b768ffc..82e0f82 100644 --- a/src/main/java/kr/kernel/teachme/common/aop/LogAspect.java +++ b/src/main/java/kr/kernel/teachme/common/aop/LogAspect.java @@ -14,7 +14,9 @@ public class LogAspect { @Pointcut("within(kr.kernel.teachme.domain.crawler.controller.*) || " + "within(kr.kernel.teachme.domain.lecture.controller.*) || " + - "within(kr.kernel.teachme.domain.member.controller.*)") + "within(kr.kernel.teachme.domain.member.controller.*) || " + + "within(kr.kernel.teachme.domain.report.controller.*) || " + + "within(kr.kernel.teachme.domain.review.controller.*)") public void controller(){ } diff --git a/src/main/java/kr/kernel/teachme/domain/lecture/controller/LectureController.java b/src/main/java/kr/kernel/teachme/domain/lecture/controller/LectureController.java index 63f55bf..c9bfda8 100644 --- a/src/main/java/kr/kernel/teachme/domain/lecture/controller/LectureController.java +++ b/src/main/java/kr/kernel/teachme/domain/lecture/controller/LectureController.java @@ -1,7 +1,6 @@ package kr.kernel.teachme.domain.lecture.controller; import io.swagger.annotations.ApiOperation; -import kr.kernel.teachme.domain.lecture.dto.PaginationResponse; import kr.kernel.teachme.domain.lecture.dto.SearchRequest; import kr.kernel.teachme.domain.lecture.entity.Lecture; import kr.kernel.teachme.domain.lecture.service.LectureService; @@ -10,7 +9,6 @@ import kr.kernel.teachme.domain.review.entity.Review; import kr.kernel.teachme.domain.review.service.ReviewService; import lombok.RequiredArgsConstructor; - import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -20,7 +18,6 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; -import java.util.List; import java.util.Optional; @RequiredArgsConstructor @@ -36,7 +33,7 @@ public class LectureController { @GetMapping("/list") public String showLectureList(@RequestParam(defaultValue = "1") int page, Model model, @ModelAttribute SearchRequest search) { Pageable pageable = PageRequest.of(page -1, 10, Sort.Direction.DESC, "id"); - PaginationResponse> lectureApiList = lectureService.searchList(pageable, search); + Page lectureApiList = lectureService.searchList(pageable, search); model.addAttribute("lecturePage", lectureApiList); return "lecture/list"; } diff --git a/src/main/java/kr/kernel/teachme/domain/lecture/dto/Pagination.java b/src/main/java/kr/kernel/teachme/domain/lecture/dto/Pagination.java deleted file mode 100644 index 2684cef..0000000 --- a/src/main/java/kr/kernel/teachme/domain/lecture/dto/Pagination.java +++ /dev/null @@ -1,13 +0,0 @@ -package kr.kernel.teachme.domain.lecture.dto; - -import lombok.*; - -@Data -@Builder -public class Pagination { - private Integer page; - private Integer size; - private Integer currentElements; - private Integer totalPage; - private Long totalElements; -} diff --git a/src/main/java/kr/kernel/teachme/domain/lecture/dto/PaginationResponse.java b/src/main/java/kr/kernel/teachme/domain/lecture/dto/PaginationResponse.java deleted file mode 100644 index 00905b0..0000000 --- a/src/main/java/kr/kernel/teachme/domain/lecture/dto/PaginationResponse.java +++ /dev/null @@ -1,17 +0,0 @@ -package kr.kernel.teachme.domain.lecture.dto; - -import lombok.Builder; -import lombok.Data; - -@Data -@Builder -public class PaginationResponse { - private T body; - private Pagination pagination; - - public static PaginationResponse of(T content, int number, int size, int totalPages, int currentElements, Long totalElements) { - return new PaginationResponse<>(content, new Pagination(number, size, currentElements, totalPages, totalElements)); - } -} - - diff --git a/src/main/java/kr/kernel/teachme/domain/lecture/service/LectureService.java b/src/main/java/kr/kernel/teachme/domain/lecture/service/LectureService.java index d31ed41..1b351c7 100644 --- a/src/main/java/kr/kernel/teachme/domain/lecture/service/LectureService.java +++ b/src/main/java/kr/kernel/teachme/domain/lecture/service/LectureService.java @@ -1,9 +1,7 @@ package kr.kernel.teachme.domain.lecture.service; -import kr.kernel.teachme.domain.lecture.dto.PaginationResponse; import kr.kernel.teachme.domain.lecture.dto.SearchRequest; import kr.kernel.teachme.domain.lecture.entity.Lecture; -import kr.kernel.teachme.domain.lecture.dto.Pagination; import kr.kernel.teachme.domain.lecture.repository.LectureRepository; import lombok.RequiredArgsConstructor; @@ -25,32 +23,15 @@ public List getLatestLectures() { return lectureRepository.findByOrderByIdDesc(PageRequest.of(0, 12)); } - public PaginationResponse> searchList(Pageable pageable, SearchRequest search) { - Page page = findLectures(pageable, search); - Pagination pagination = createPagination(page); - return buildPaginationResponse(page, pagination); + public Page searchList(Pageable pageable, SearchRequest search) { + return findLectures(pageable, search); } private Page findLectures(Pageable pageable, SearchRequest searchRequest) { return lectureRepository.findBySearchOption(pageable, searchRequest); } - private Pagination createPagination(Page page) { - return Pagination.builder() - .page(page.getNumber()) - .size(page.getSize()) - .currentElements(page.getNumberOfElements()) - .totalElements(page.getTotalElements()) - .totalPage(page.getTotalPages()) - .build(); - } - private PaginationResponse> buildPaginationResponse(Page page, Pagination pagination) { - return PaginationResponse.>builder() - .body(page.getContent()) - .pagination(pagination) - .build(); - } public Optional getLectureDetail(Long lectureId) { return lectureRepository.findById(lectureId); diff --git a/src/main/resources/templates/lecture/list.html b/src/main/resources/templates/lecture/list.html index 80d064c..b38b338 100644 --- a/src/main/resources/templates/lecture/list.html +++ b/src/main/resources/templates/lecture/list.html @@ -51,10 +51,10 @@ - + 검색된 강의가 없습니다.🥲 - + ... @@ -88,16 +88,16 @@