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.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:44
 * @Description:
 */
public interface LoadingTaskRecipeDao extends BaseDao<LoadingTaskRecipe, Long> {

    @Modifying
    @Transactional
    @Query(value = "DELETE FROM production_loading_task_recipe WHERE loading_task_id = ?1", nativeQuery = true)
    void deleteByLoadingTaskId(Long loadingTaskId);

    @Query(value = "SELECT *  FROM `production_loading_task_recipe` WHERE  loading_task_id = ?1 ", nativeQuery = true)
    List<LoadingTaskRecipe> findByLoadingTaskId(Long loadingTaskId);
}
