-
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.
Browse files
Browse the repository at this point in the history
[Feat/#31] 경험 기록 리스트 조회 기능 구현
- Loading branch information
Showing
10 changed files
with
237 additions
and
4 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
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
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
41 changes: 41 additions & 0 deletions
41
src/main/java/corecord/dev/domain/record/repository/RecordRepository.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,9 +1,50 @@ | ||
package corecord.dev.domain.record.repository; | ||
|
||
import corecord.dev.domain.analysis.constant.Keyword; | ||
import corecord.dev.domain.folder.entity.Folder; | ||
import corecord.dev.domain.record.entity.Record; | ||
import corecord.dev.domain.user.entity.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface RecordRepository extends JpaRepository<Record, Long> { | ||
|
||
@Query("SELECT r " + | ||
"FROM Record r " + | ||
"JOIN FETCH r.analysis a " + | ||
"JOIN FETCH r.folder f " + | ||
"JOIN FETCH a.abilityList al " + | ||
"WHERE r.user = :user " + | ||
"AND r.folder is not null AND r.folder = :folder "+ // 임시 저장 기록 제외 | ||
"ORDER BY r.createdAt desc ") // 최근 생성 순 정렬 | ||
List<Record> findRecordsByFolder( | ||
@Param(value = "folder") Folder folder, | ||
@Param(value = "user") User user); | ||
|
||
@Query("SELECT r FROM Record r " + | ||
"JOIN FETCH r.analysis a " + | ||
"JOIN FETCH r.folder f " + | ||
"JOIN FETCH a.abilityList al " + | ||
"WHERE r.user = :user " + | ||
"AND r.folder is not null " + // 임시 저장 기록 제외 | ||
"ORDER BY r.createdAt DESC") // 최근 생성 순 정렬 | ||
List<Record> findRecords(@Param(value = "user") User user); | ||
|
||
|
||
@Query("SELECT r FROM Ability a " + | ||
"JOIN a.analysis an " + | ||
"JOIN an.record r " + | ||
"JOIN FETCH r.folder f " + | ||
"WHERE a.user = :user " + | ||
"AND a.keyword = :keyword " + | ||
"AND r.folder is not null " + // 임시 저장 기록 제외 | ||
"ORDER BY r.createdAt DESC") // 최근 생성 순 정렬 | ||
List<Record> findRecordByKeyword( | ||
@Param(value = "keyword")Keyword keyword, | ||
@Param(value = "user") User user); | ||
} |
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