Skip to content

Commit

Permalink
๐Ÿž bugfix/#134 : 3.1 ๊ฐ€๊ฒŒ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ event join ์ œ๊ฑฐ
Browse files Browse the repository at this point in the history
Signed-off-by: EunJiJung <[email protected]>
  • Loading branch information
bianbbc87 committed Nov 23, 2024
1 parent 6fa372a commit 22e5063
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ public ReadStoreOverviewsResponseDto execute(
// title null ์ฒ˜๋ฆฌ
title = storeService.convertToTitle(title);

Page<Store> storesPage = storeRepository.findStoresByEarliestEventOrdered(title, onjungTagsList, pageable);
Page<Store> storesPage = storeRepository.findStores(title, onjungTagsList, pageable);

/*
// ์ƒ์ ์ด ์—†์„ ๊ฒฝ์šฐ
if (storeList.isEmpty()) {
return new ReadStoreOverviewsResponseDto(false, List.of());
}
*/
// total onjung count๋ณ„ ์ •๋ ฌ
List<ReadStoreOverviewsResponseDto.StoreOverviewDto> storeOverviewDtos = storesPage.stream()
.map(store -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@ public interface StoreRepository extends JpaRepository <Store, Long> {
Optional<Store> findWithOnjungTagsById(Long id);

@Query("SELECT s FROM Store s " +
"LEFT JOIN s.events e ON e.endDate = ( " +
" SELECT MIN(e1.endDate) FROM Event e1 " +
" WHERE e1.store.id = s.id AND e1.endDate > CURRENT_DATE" +
") " +
"LEFT JOIN s.onjungTags tag " +
"WHERE (:title IS NULL OR s.title LIKE %:title%) " +
"AND (:onjungTags IS NULL OR tag IN :onjungTags) " +
"GROUP BY s.id " +
"ORDER BY MIN(e.endDate) ASC")
Page<Store> findStoresByEarliestEventOrdered(
"ORDER BY s.id ASC") // ์ •๋ ฌ ๊ธฐ์ค€์„ ID๋กœ ์œ ์ง€ํ•˜๊ฑฐ๋‚˜ ์›ํ•˜๋Š” ๊ธฐ์ค€์œผ๋กœ ์ˆ˜์ •
Page<Store> findStores(
@Param("title") String title,
@Param("onjungTags") List<EOnjungTag> onjungTags,
Pageable pageable
Expand Down

0 comments on commit 22e5063

Please sign in to comment.