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

import java.util.List;
import com.sw.mes.yb.plan.entity.PlanProductionOrderBom;
import com.sw.mes.core.base.BaseDao;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import com.sw.mes.core.annotation.Jinko;


/**
 * 订单Bom信息Dao接口
 * 
 * @author liru
 * @date 2023-12-31
 */
@Jinko(value="订单Bom信息Service接口",author = "liru")
public interface PlanProductionOrderBomDao extends BaseDao<PlanProductionOrderBom, Long>
{

    @Modifying
    @Query(value = "DELETE FROM `plan_production_order_bom` WHERE plan_production_order_id = ?1", nativeQuery = true)
    void deleteByPlanProductionOrderId(Long id);

    @Query(value = "SELECT * FROM plan_production_order_bom where plan_production_order_id=?1 and matnr=?2", nativeQuery = true)
	List<PlanProductionOrderBom> findByOrderIdAndMatnr(Long orderId, String matnr);

    @Query(value = "SELECT * FROM `plan_production_order_bom` WHERE plan_production_order_id = ?1 and maktx like '%氩气%' order by id desc limit 1", nativeQuery = true)
    PlanProductionOrderBom findByPlanProductionOrderId(Long id);
}
