package com.ssj.dao.kmt.kmt.dao;

import com.ssj.bean.kmt.kmt.domain.KmtExerciseLibPriority;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author yanghuan
 * @title: KmtExerciseLibPriorityDao
 * @projectName ssj
 * @description: TODO
 * @date 2020/6/4 11:13
 */
@Repository
public interface KmtExerciseLibPriorityDao extends JpaRepository<KmtExerciseLibPriority,String> {

    @Query(nativeQuery = true,value = "delete from kmt_exercise_lib_priority where subject=?1")
    @Modifying
    void deleteOrgCountBySubject(String subject);

    @Query(nativeQuery = true,value = "select * from kmt_exercise_lib_priority where lib_id=?1 and subject=?2 limit 1")
    KmtExerciseLibPriority findKmtExerciseLibPriorityByLibIdAndSubejct(String libId,String subject);

    @Query(nativeQuery = true,value = "delete from kmt_exercise_lib_priority where lib_id=?1 and subject=?2")
    @Modifying
    void deleteOrgCountByLibIdAndSubject(String libId,String subject);
}
