Skip to content

Commit

Permalink
๐Ÿž BugFix/#102 - ์ž˜๋ชป๋œ JOIN ์‚ฌ์šฉ์œผ๋กœ ์ธํ•œ, ๊ฐ€๊ฒŒ ์ƒ์„ธ์กฐํšŒ ์‹œ Donator Count๊ฐ€ ์ œ๋Œ€๋กœ ๊ตฌํ•ด์ง€์ง€ ์•Šโ€ฆ
Browse files Browse the repository at this point in the history
โ€ฆ๋Š” ๋ฒ„๊ทธ
  • Loading branch information
dongkyeomjang committed Nov 23, 2024
1 parent a8f68af commit 8767cdb
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ List<Store> findStoresByEarliestEventOrdered(

// Share, donation, receipt ์— ํฌํ•จ๋œ ์ค‘๋ณต๋œ ๊ฐ’์„ ์ œ์™ธํ•œ user์˜ ์ˆ˜
@Query("SELECT COUNT(DISTINCT u) FROM User u " +
"JOIN Share s ON u.id = s.user.id " +
"JOIN Donation d ON u.id = d.user.id " +
"JOIN Receipt r ON u.id = r.user.id " +
"WHERE s.store.id = :storeId OR d.store.id = :storeId OR r.store.id = :storeId")
"WHERE EXISTS (SELECT 1 FROM Share s WHERE s.user.id = u.id AND s.store.id = :storeId) " +
" OR EXISTS (SELECT 1 FROM Donation d WHERE d.user.id = u.id AND d.store.id = :storeId) " +
" OR EXISTS (SELECT 1 FROM Receipt r WHERE r.user.id = u.id AND r.store.id = :storeId)")
Integer countUsersByStoreId(@Param("storeId") Long storeId);

// ์ด Donation์˜ ๊ธˆ์•ก
Expand Down

0 comments on commit 8767cdb

Please sign in to comment.