package cn.com.qmth.examcloud.core.questions.dao;

import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
import cn.com.qmth.examcloud.core.questions.dao.entity.Course;
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.query.QueryByExampleExecutor;

import java.util.List;
import java.util.Set;

/**
 * Created by songyue on 16/12/28.
 */
public interface QuesRepo extends MongoRepository<Question, String>, QueryByExampleExecutor<Question> {

    Page<Question> findByIdNotInAndCourseNoAndOrgId(Set<String> idSet, String courseNo, String orgId, Pageable page);

    Page<Question> findByIdNotInAndCourseNoAndQuestionTypeAndOrgId(Set<String> idSet, String courseNo,
                                                                   QuesStructType quesType, String orgId, Pageable page);

    List<Question> findByCourseNoAndOrgId(String courseNo, String orgId);

    List<Question> findBySpecialtyCodeAndOrgId(String specialtyCode, String orgId);

    List<Question> findByCourseAndOrgId(Course course, String orgId);

    List<Question> findByIdIn(Set<String> ids);

	void deleteByOrgId(String orgId);
}
