Skip to content

Commit

Permalink
mod #75: 문제 조회 쿼리 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
GiHoo committed May 19, 2024
1 parent 42166d6 commit 3c53399
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.syu.capsbe.domain.problem;

import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
Expand All @@ -9,8 +8,8 @@
@Repository
public interface ProblemRepository extends JpaRepository<Problem, Long> {

@Query("SELECT p FROM Problem p WHERE p.problemType = :problemType ORDER BY RAND() LIMIT :problemCount")
List<Problem> getProblemTypeIsWord(ProblemType problemType, int problemCount);
@Query("SELECT p FROM Problem p WHERE p.problemType = :problemType ORDER BY RAND() LIMIT 1")
Optional<Problem> getProblemByProblemType(ProblemType problemType);

Optional<Problem> findProblemById(Long problemId);
}

0 comments on commit 3c53399

Please sign in to comment.