-
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.
Browse files
Browse the repository at this point in the history
[Feat/#35] 역량 키워드 리스트 조회 기능 구현
- Loading branch information
Showing
8 changed files
with
76 additions
and
5 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
22 changes: 22 additions & 0 deletions
22
src/main/java/corecord/dev/domain/analysis/repository/AnalysisRepository.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,31 @@ | ||
package corecord.dev.domain.analysis.repository; | ||
|
||
import corecord.dev.domain.analysis.constant.Keyword; | ||
import corecord.dev.domain.analysis.entity.Analysis; | ||
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; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface AnalysisRepository extends JpaRepository<Analysis, Long> { | ||
|
||
@Query("SELECT a " + | ||
"FROM Analysis a " + | ||
"JOIN FETCH a.record r " + | ||
"JOIN FETCH a.abilityList al " + | ||
"WHERE a.analysisId = :id") | ||
Optional<Analysis> findAnalysisById(@Param(value = "id") Long id); | ||
|
||
@Query("SELECT distinct a.keyword AS keyword " + // unique한 keyword list 반환 | ||
"FROM Ability a " + | ||
"JOIN a.analysis ana " + | ||
"WHERE a.user = :user " + | ||
"GROUP BY a.keyword " + | ||
"ORDER BY COUNT(a.keyword) DESC, MAX(ana.createdAt) DESC ") // 개수가 많은 순, 최근 생성 순 정렬 | ||
List<Keyword> getKeywordList(@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
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