-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/ripple/BE/learning/repository/quizScrap/QuizScrapRepositoryCustom.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.ripple.BE.learning.repository.quizScrap; | ||
|
||
import com.ripple.BE.learning.domain.quiz.Quiz; | ||
import java.util.List; | ||
|
||
public interface QuizScrapRepositoryCustom { | ||
|
||
List<Quiz> findQuizScrappedByUser(Long userId); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/ripple/BE/learning/repository/quizScrap/QuizScrapRepositoryCustomImpl.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.ripple.BE.learning.repository.quizScrap; | ||
|
||
import static com.ripple.BE.learning.domain.quiz.QQuiz.*; | ||
import static com.ripple.BE.learning.domain.quiz.QQuizScrap.*; | ||
import static com.ripple.BE.post.domain.QPost.*; | ||
import static com.ripple.BE.post.domain.QPostScrap.*; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import com.ripple.BE.learning.domain.quiz.Quiz; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class QuizScrapRepositoryCustomImpl implements QuizScrapRepositoryCustom { | ||
|
||
private final JPAQueryFactory queryFactory; | ||
|
||
@Override | ||
public List<Quiz> findQuizScrappedByUser(Long userId) { | ||
return queryFactory | ||
.select(quiz) | ||
.from(quizScrap) | ||
.join(quizScrap.quiz, quiz) | ||
.where(quizScrap.user.id.eq(userId)) | ||
.fetch(); | ||
} | ||
} |