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

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.yb.pad.entity.RecutDetail;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

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

    List<RecutDetail> findBySectionNoFb(String sectionNoFb);


    @Query(value = "select * from recut_fb_detail  where section_no_fb IN(?1)", nativeQuery = true)
    List<RecutDetail> findBySectionNoFb(List<String> sectionNoFbs);

    List<RecutDetail> findByParentId(Long id);

    List<RecutDetail> findByCrystalIdAndParentId(Long crystalId, Long parentId);

    @Query(value = "select rd from RecutDetail rd where rd.pieceNoHead = ?1 OR rd.pieceNoEnd = ?1")
    List<RecutDetail> findByPieceNoHeadOrPieceNoEnd(String pieceNo);

    List<RecutDetail> findBySectionNo(String sectionNo);
}
