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

import com.sw.mes.core.base.BaseDao;
import com.sw.mes.yb.production.entity.FillingTaskRecipe;
import com.sw.mes.yb.production.entity.InputFurnaceBurden;
import com.sw.mes.yb.production.entity.LoadingTaskRecipe;
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: xushu
 * @Date: 2022/11/26/15:42
 * @Description:
 */
public interface FillingTaskRecipeDao extends BaseDao<FillingTaskRecipe, Long> {

    @Modifying
    @Transactional
    @Query(value = "DELETE FROM production_filling_task_recipe WHERE again_task_detail_id = ?1", nativeQuery = true)
    void deleteByAgainTaskDetailId(Long againTaskDetailId);


    @Query(value = "SELECT *  FROM `production_filling_task_recipe` WHERE  again_task_detail_id = ?1 ", nativeQuery = true)
    List<FillingTaskRecipe> findByAgainTaskDetailId(Long againTaskDetailId);

    @Query(value = "SELECT *  FROM `production_filling_task_recipe` WHERE  again_task_detail_id in (?1) ", nativeQuery = true)
    List<FillingTaskRecipe> findByIds(List<Long> againTaskDetailIds);
}
