package com.yihu.jw.doctor.dao;

import com.yihu.jw.entity.base.doctor.DoctorSpecialDiseaseDo;
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 org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zmk
 * @vsrsion 1.0
 * Created at 2019/12/10
 */
@Transactional
public interface DoctorSpecialDiseaseDao extends PagingAndSortingRepository<DoctorSpecialDiseaseDo, Integer>, JpaSpecificationExecutor<DoctorSpecialDiseaseDo> {

    List<DoctorSpecialDiseaseDo> findByDoctorCode(String doctorCode);

    @Modifying
    @Query("delete from DoctorSpecialDiseaseDo p where p.doctorCode=?1")
    void deleteByDoctorCode(String doctorCode);

}
