Skip to content

Commit

Permalink
Update ArtRepository.java
Browse files Browse the repository at this point in the history
  • Loading branch information
lalabulla authored Nov 6, 2024
1 parent f9701fb commit 7201970
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public interface ArtRepository extends JpaRepository<Art, Long> {
List<Art> findArtByDate(Long userId);

// 취향 별 랜덤 추출 5개
@Query(value = "select a from Art a where a.artType = :type and a.randomId >= floor(rand() * 100000000) limit 5", nativeQuery = true)
@Query(value = "select * from Art a where a.art_type = :type and a.random_id >= floor(rand() * 100000000) limit 5", nativeQuery = true)
List<Art> findArtByGenre(ArtType type);

// 취향 정보가 없을 때 랜덤 추출 5개
@Query(value = "select a from Art a where a.randomId >= floor(rand() * 100000000) limit 5", nativeQuery = true)
@Query(value = "select * from Art a where a.random_id >= floor(rand() * 100000000) limit 5", nativeQuery = true)
List<Art> findArtByNoGenre();

@Query(value = "select a from Art a where a.startDate >= :date and a.randomId >= floor(rand() * 100000000) limit 1", nativeQuery = true)
@Query(value = "select * from Art a where a.start_date >= :date and a.random_id >= floor(rand() * 100000000) limit 1", nativeQuery = true)
Art findArtByTodayAndRandom(String date);
}

0 comments on commit 7201970

Please sign in to comment.