lrj
1 天以前 9f8395fab13ca4b230a0f7d62636e209745c91d4
backend/src/main/java/com/rongyichuang/judge/repository/JudgeRepository.java
@@ -8,6 +8,7 @@
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface JudgeRepository extends JpaRepository<Judge, Long>, JpaSpecificationExecutor<Judge> {
@@ -16,4 +17,20 @@
    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);
}