package com.sw.mes.wms.dao;

import java.util.List;
import java.util.Map;

import com.sw.mes.wms.entity.LogWmsMesInteractive;
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;


/**
 * 晶科WMS下发数据通信记录Dao接口
 *
 * @author liru
 * @date 2024-01-08
 */
@Jinko(value = "晶科WMS下发数据通信记录Service接口", author = "liru")
public interface LogWmsMesInteractiveDao extends BaseDao<LogWmsMesInteractive, Long> {

    /**
     * 分页查询wms到线边仓发料的接口
     *
     * @param page
     * @param pageSize
     * @return
     */
    @Query(value = "SELECT return_context as rtn ,context as ctx FROM log_wms_mes_interactive WHERE controller_name = '晶科WMS原辅料发线边仓' limt #{page},#{pageSize}", nativeQuery = true)
    List<Map<String, Object>> filterWMSToWarehouse(int page, int pageSize);

    @Query(value = "SELECT * FROM `log_wms_mes_interactive` WHERE `controller_name` = ?1 and create_time >= ?2 and create_time <= ?3 ORDER BY id ASC ", nativeQuery = true)
	List<LogWmsMesInteractive> findByControllerNameAndTimeRange(String controllerName, String createTimeStart,
			String createTimeEnd);
}
