package com.sunda.spmsorder.mapper;

import com.sunda.spmsorder.entity.OrderKeyValueConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

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

/**
 * <p>
 * 订单请购码值配置信息表 Mapper 接口
 * </p>
 *
 * @author Wayne
 * @since 2020-12-22
 */
@Component
@Mapper
public interface OrderKeyValueConfigMapper extends BaseMapper<OrderKeyValueConfig> {

    @Select("<script>" +
            "SELECT UUID,FIELD_KEY,FIELD_NAME,KEY_CODE," +
            "KEY_CODE_DESC,KEY_CODE_EN_DESC,KEY_CODE_RU_DESC,KEY_CODE_FR_DESC,ENABLED,SORT_NO," +
            "REMARK,OVERSEA_TYPE,WHS_TYPE FROM ORDER_KEY_VALUE_CONFIG \n" +
            "where KEY_CODE like  CONCAT(CONCAT('', #{keyCode}), '%') and FIELD_KEY =#{fieldKey} and ENABLED ='1' " +
            "</script>\n")
    List<OrderKeyValueConfig> getKeyValueByKeyCode(@Param("keyCode")String keyCode,
                                                      @Param("fieldKey")String fieldKey);
}
