package com.sw.mes.yb.pc.dao;


import com.sw.mes.core.base.BaseDao;
import com.sw.mes.yb.pc.entity.SpellInfo;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author
 * @Description：
 * @Date:
 * @Modified By:
 */
public interface SpellInfoDao extends BaseDao<SpellInfo, Long> {

    @Modifying
    @Transactional
    @Query(value = "DELETE FROM zhxx_yb_data_spell_info WHERE section_id=?1 ", nativeQuery = true)
    void deleteBySectionId(Long sectionId);

    List<SpellInfo> findBySectionNo(String sectionNo);

    List<SpellInfo> findBySectionNoIn(List<String> sectionNos);

    @Modifying
    @Transactional
    @Query(value = "DELETE FROM zhxx_yb_data_spell_info WHERE section_no IN (?1) ", nativeQuery = true)
    void deleteBySectionNos(List<String> sectionNos);

    List<SpellInfo> findBySectionId(Long sectionId);

}

