| | |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | @Repository |
| | | public interface JudgeRepository extends JpaRepository<Judge, Long>, JpaSpecificationExecutor<Judge> { |
| | |
| | | List<Judge> findByNameContaining(@Param("name") String name); |
| | | |
| | | boolean existsByPhone(String phone); |
| | | |
| | | /** |
| | | * 根据用户ID查找评委 |
| | | */ |
| | | Optional<Judge> findByUserId(Long userId); |
| | | |
| | | /** |
| | | * 检查评委是否参与指定活动 |
| | | */ |
| | | @Query("SELECT COUNT(aj) > 0 FROM ActivityJudge aj WHERE aj.judgeId = :judgeId AND aj.activityId = :activityId") |
| | | boolean existsByIdAndActivityId(@Param("judgeId") Long judgeId, @Param("activityId") Long activityId); |
| | | |
| | | /** |
| | | * 根据状态统计评委数量 |
| | | */ |
| | | long countByState(Integer state); |
| | | } |