You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
1.1 KiB

package cn.teammodel.repository;
import cn.teammodel.model.entity.common.Exam;
import com.azure.spring.data.cosmos.repository.CosmosRepository;
import com.azure.spring.data.cosmos.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
@Repository
public interface ExamRepository extends CosmosRepository<Exam, String> {
@Query("select * from Exam as s where s.code = @code and array_contains(s.classes,@classId) and s.period.id = @periodId and s.progress = 'finish' order by s.createTime ")
List<Exam> findExamByClassId(@Param("code")String code, @Param("classId")String classId, @Param("periodId")String periodId);
@Query("select * from Exam as s where s.code = @code and s.id = @id")
List<Exam> findExamById(@Param("code")String code, @Param("id")String id);
@Query("select s.id,s.name,s.average,s.classes,s.stuCount,s.createTime,s.papers from Exam as s where s.code = @code and s.lessonRecordId in (@ids)")
List<Exam> findExamsByIds(String code, Collection<String> ids);
}