Skip to content

Commit

Permalink
feat: 특정 선착순 이벤트에 참여한 특정 유저가 존재하는지 체크하는 JQPL 쿼리 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
wjddn2165 committed Aug 6, 2024
1 parent a81f5ab commit 86a8b9b
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package JGS.CasperEvent.domain.event.repository.participantsRepository;

import JGS.CasperEvent.domain.event.entity.participants.RushParticipants;
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;

@Repository
public interface RushParticipantsRepository {
public interface RushParticipantsRepository extends JpaRepository<RushParticipants, String> {
@Query("SELECT CASE WHEN COUNT(rp) > 0 THEN TRUE ELSE FALSE END " +
"FROM RushParticipants rp " +
"WHERE rp.rushEvent.rushEventId = :eventId AND rp.id = :userId")
boolean existsByRushEventIdAndUserId(@Param("eventId") Long eventId, @Param("userId") String userId);
}

0 comments on commit 86a8b9b

Please sign in to comment.