-
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.
feat: 특정 선착순 이벤트에 참여한 특정 유저가 존재하는지 체크하는 JQPL 쿼리 작성
- Loading branch information
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 9 additions & 1 deletion
10
...asperEvent/domain/event/repository/participantsRepository/RushParticipantsRepository.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,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); | ||
} |