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

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

import java.util.List;

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

    @Query(value = "select * from production_loading_task_log where lot_no=?1 and recipe_user_name is not null and recipe_user_name !='' order by id desc limit 1", nativeQuery = true)
    public LoadingTaskLog findByLotNoWithRecipeUserName(String lotNo);

    @Query(value = "select * from production_loading_task_log where loading_task_id=?1 order by id desc limit 1", nativeQuery = true)
    LoadingTaskLog getByLoadingTaskId(Long loadingTaskId);

    @Query(value = "select * from production_loading_task_log where loading_task_id=?1 ", nativeQuery = true)
    List<LoadingTaskLog> findBylLoadingTaskId(Long id);
}
