From cdb4d2ff8ccf2085a79b05bb322d73feddb3e04c Mon Sep 17 00:00:00 2001 From: JSoi Date: Sat, 30 Jul 2022 16:34:03 +0900 Subject: [PATCH] =?UTF-8?q?#23=20[Update]=20=EC=97=85=EC=9E=A5=20=ED=95=84?= =?UTF-8?q?=ED=84=B0=EB=A7=81=20case=20=EC=B6=94=EA=B0=80=20-=20=EB=B6=81?= =?UTF-8?q?=EB=A7=88=ED=81=AC=EC=88=9C=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/repository/StoreQueryRepository.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/mpnp/baechelin/store/repository/StoreQueryRepository.java b/src/main/java/com/mpnp/baechelin/store/repository/StoreQueryRepository.java index 243b25a..8187493 100644 --- a/src/main/java/com/mpnp/baechelin/store/repository/StoreQueryRepository.java +++ b/src/main/java/com/mpnp/baechelin/store/repository/StoreQueryRepository.java @@ -113,14 +113,13 @@ private Page findStoreOrderByPointNullCase(BooleanBuilder builder, return new PageImpl<>(storeList, pageable, fetchCount); } - //TODO 북마크순 public Page findStoreOrderByBookmark(BigDecimal lat, BigDecimal lng, String category, List facility, Pageable pageable) { - BooleanBuilder builder = locTwoPointAndConditions(lat, lng, category, facility); + if (lat == null || lng == null) return findStoreOrderByBookmarkNullCase(builder, pageable); List storeList = queryFactory.selectFrom(store) .where(builder) .orderBy(store.bookMarkCount.desc()) @@ -132,6 +131,19 @@ public Page findStoreOrderByBookmark(BigDecimal lat, return new PageImpl<>(storeList, pageable, fetchCount); } + public Page findStoreOrderByBookmarkNullCase(BooleanBuilder builder, + Pageable pageable) { + + List storeList = queryFactory.selectFrom(store) + .where(builder) + .orderBy(store.bookMarkCount.desc()) + .limit(pageable.getPageSize()) + .offset(pageable.getOffset()) + .fetch(); + int fetchCount = queryFactory.selectFrom(store).where(builder).fetch().size(); + return new PageImpl<>(storeList, pageable, fetchCount); + } + // 주소로 검색, 검색어로 검색 public List searchStores(String sido, String sigungu, String keyword, Pageable pageable) { BooleanExpression matchAddress = QueryDslSearch.matchAddress(sido, sigungu);