package cn.teammodel.repository;

import cn.teammodel.model.entity.common.ExamClassResult;
import com.azure.spring.data.cosmos.repository.CosmosRepository;
import com.azure.spring.data.cosmos.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;
@Repository
public interface ExamClassResultRepository extends CosmosRepository<ExamClassResult, String> {
    @Query("select * from ExamClassResult as s where s.code = @code and s.examId in (@ids) ")
    List<ExamClassResult> findAll(String code, Collection<String> ids);
    @Query("select * from ExamClassResult as s where s.code = @code and s.info.id = @id and s.examId = @examId")
    List<ExamClassResult> findById(String code, String id,String examId);
    @Query("select * from ExamClassResult as s where s.code = @code and array_contains(s.studentIds ,@studentId) and s.examId = @examId")
    List<ExamClassResult> findByStudentId(String code, String studentId,String examId);

}
