-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MATE-103 : [REFACTOR] 회원 프로필 타임라인 조회 성능 개선 (#112)
* MATE-103 : [REFACTOR] QueryDSL을 활용하여 가져오던 참여 직관 목록, 경기 정보를 VisitRepository JPQL로 수정 * MATE-103 : [REFACTOR] 타임라인 조회 SQL 쿼리 및 성능 개선 * MATE-103 : [TEST] 타임라인 조회 서비스 테스트
- Loading branch information
Showing
10 changed files
with
134 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 13 additions & 3 deletions
16
src/main/java/com/example/mate/domain/mate/repository/MateReviewRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
package com.example.mate.domain.mate.repository; | ||
|
||
import com.example.mate.domain.mate.entity.MateReview; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
|
||
public interface MateReviewRepository extends JpaRepository<MateReview, Long> { | ||
|
||
int countByRevieweeId(Long revieweeId); | ||
|
||
Optional<MateReview> findMateReviewByVisitIdAndReviewerIdAndRevieweeId(Long visitId, Long reviewerId, | ||
Long revieweeId); | ||
@Query(""" | ||
SELECT mr | ||
FROM MateReview mr | ||
WHERE mr.visit.id = :visitId | ||
AND mr.reviewer.id = :reviewerId | ||
ORDER BY mr.reviewee.id ASC | ||
""") | ||
List<MateReview> findMateReviewsByVisitIdAndReviewerId(@Param("visitId") Long visitId, | ||
@Param("reviewerId") Long reviewerId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/example/mate/domain/mate/repository/VisitRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
package com.example.mate.domain.mate.repository; | ||
|
||
import com.example.mate.domain.match.entity.Match; | ||
import com.example.mate.domain.mate.entity.Visit; | ||
import com.example.mate.domain.member.dto.response.MyTimelineResponse; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
|
||
public interface VisitRepository extends JpaRepository<Visit, Long> { | ||
|
||
@Query(""" | ||
SELECT new com.example.mate.domain.member.dto.response.MyTimelineResponse(v.id, v.post.id, vp.member.id) | ||
FROM Visit v | ||
JOIN v.participants vp | ||
WHERE vp.member.id = :memberId | ||
ORDER BY v.id DESC | ||
""") | ||
Page<MyTimelineResponse> findVisitsByMemberId(@Param("memberId") Long memberId, Pageable pageable); | ||
|
||
@Query(""" | ||
SELECT m | ||
FROM Visit v | ||
JOIN v.post mp | ||
JOIN mp.match m | ||
JOIN v.participants vp | ||
WHERE vp.member.id = :memberId | ||
ORDER BY v.id DESC | ||
""") | ||
List<Match> findMatchesByMemberId(@Param("memberId") Long memberId); | ||
} |
10 changes: 0 additions & 10 deletions
10
src/main/java/com/example/mate/domain/member/repository/TimelineRepositoryCustom.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
src/main/java/com/example/mate/domain/member/repository/TimelineRepositoryCustomImpl.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.