package cn.com.qmth.stmms.biz.exam.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import cn.com.qmth.stmms.biz.exam.model.SelectiveStudent;

public interface SelectiveStudentDao extends JpaRepository<SelectiveStudent, Integer>,
        PagingAndSortingRepository<SelectiveStudent, Integer>, JpaSpecificationExecutor<SelectiveStudent> {

    @Modifying(clearAutomatically = true)
    void deleteByExamIdAndSubjectCode(Integer examId, String subjectCode);

    @Modifying(clearAutomatically = true)
    @Query("delete SelectiveStudent s where s.studentId=?1")
    void deleteByStudentId(Integer studentId);

}
