package com.prolog.eis.dao.out;

import com.prolog.eis.model.container.StationCfg;
import com.prolog.framework.dao.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zmr
 * @description: 站台配置表-数据处理类
 * @date 2023-08-30 12:26
 */
@Repository
public interface StationCfgMapper extends BaseMapper<StationCfg>{
    @Select("<script>select id,station_no stationNo, " +
            " (select state_description from data_dictionary where state_name = 'station_type' and state_vlues = task_type) taskTypeStr, is_lock isLock, \n" +
            "  max_order_number maxOrderNumber, max_cache_position maxCachePosition, \n" +
            "  create_time createTime, update_time updateTime, is_ask isAsk,task_type taskType FROM station_cfg  \n" +
            "   WHERE 1 =1  " +
            "<if test=\"stationNo != null and stationNo != ''\">\n" +
            "  and station_no = #{stationNo,jdbcType=VARCHAR}\n" +
            "</if>"+
            "<if test=\"isLock != null\">\n" +
            "  and is_lock = #{isLock,jdbcType=INTEGER}\n" +
            "</if>" +
            "<if test=\"taskType != null\">\n" +
            "  and task_type = #{taskType,jdbcType=INTEGER}\n" +
            "</if> </script>")
    List<StationCfg> query(@Param("stationNo") String stationNo, @Param("taskType") Integer taskType, @Param("isLock") Integer isLock);


    List<StationCfg> getStationCfg(@Param("stationNo") String stationNo);

}