diff --git a/src/main/java/com/matdongsan/domain/place/PlaceRepository.java b/src/main/java/com/matdongsan/domain/place/PlaceRepository.java index dd75a8a..bfd1a15 100644 --- a/src/main/java/com/matdongsan/domain/place/PlaceRepository.java +++ b/src/main/java/com/matdongsan/domain/place/PlaceRepository.java @@ -3,6 +3,6 @@ import org.springframework.data.jpa.repository.JpaRepository; -public interface PlaceRepository extends JpaRepository { +public interface PlaceRepository extends JpaRepository, PlaceRepositoryCustom { boolean existsById(long id); } diff --git a/src/main/java/com/matdongsan/service/PlaceService.java b/src/main/java/com/matdongsan/service/PlaceService.java index 9ff23e0..0698920 100644 --- a/src/main/java/com/matdongsan/service/PlaceService.java +++ b/src/main/java/com/matdongsan/service/PlaceService.java @@ -116,4 +116,8 @@ private void pullInfo(Place place) { } } + public List findTop5Place() { + return placeRepository.findByTop5Place(); + } + } diff --git a/src/main/java/com/matdongsan/web/controller/MainPageController.java b/src/main/java/com/matdongsan/web/controller/MainPageController.java index 4e0b18f..fb08220 100644 --- a/src/main/java/com/matdongsan/web/controller/MainPageController.java +++ b/src/main/java/com/matdongsan/web/controller/MainPageController.java @@ -1,5 +1,6 @@ package com.matdongsan.web.controller; +import com.matdongsan.service.PlaceService; import com.matdongsan.service.PostService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -13,10 +14,12 @@ public class MainPageController { private final PostService postService; + private final PlaceService placeService; @GetMapping("/") public String mainPageMapping(Model model) { - model.addAttribute("top5", postService.findTop5Post()); + model.addAttribute("top5Post", postService.findTop5Post()); + model.addAttribute("top5Place", placeService.findTop5Place()); return "index"; } diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 87a1c00..1df209f 100755 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -74,56 +74,66 @@
맛집 둘러보기
-->

인기 플레이스 TOP 5

-