Skip to content

Commit

Permalink
#23 [Update] 업장 필터링 case 추가 - 북마크순 정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
JSoi committed Jul 30, 2022
1 parent 82013a1 commit cdb4d2f
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,13 @@ private Page<Store> findStoreOrderByPointNullCase(BooleanBuilder builder,
return new PageImpl<>(storeList, pageable, fetchCount);
}

//TODO 북마크순
public Page<Store> findStoreOrderByBookmark(BigDecimal lat,
BigDecimal lng,
String category,
List<String> facility,
Pageable pageable) {

BooleanBuilder builder = locTwoPointAndConditions(lat, lng, category, facility);
if (lat == null || lng == null) return findStoreOrderByBookmarkNullCase(builder, pageable);
List<Store> storeList = queryFactory.selectFrom(store)
.where(builder)
.orderBy(store.bookMarkCount.desc())
Expand All @@ -132,6 +131,19 @@ public Page<Store> findStoreOrderByBookmark(BigDecimal lat,
return new PageImpl<>(storeList, pageable, fetchCount);
}

public Page<Store> findStoreOrderByBookmarkNullCase(BooleanBuilder builder,
Pageable pageable) {

List<Store> 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<Store> searchStores(String sido, String sigungu, String keyword, Pageable pageable) {
BooleanExpression matchAddress = QueryDslSearch.matchAddress(sido, sigungu);
Expand Down

0 comments on commit cdb4d2f

Please sign in to comment.