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

import java.util.List;

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.UserExam;

public interface UserExamDao extends PagingAndSortingRepository<UserExam, Integer>, JpaSpecificationExecutor<UserExam> {

    List<UserExam> findByUserId(Integer userId);

    UserExam findByExamIdAndUserId(Integer examId, Integer userId);

    @Modifying
    @Query("delete from UserExam su where su.userId=?1")
    void deleteByUserId(Integer userId);
}
