zoukankan      html  css  js  c++  java
  • org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found.

    1. 情景重现

    1.1 Mapper 代码

    public interface DeviceFileInfoVOMapper {
    
        List<QueryFileDTO> selectVideoByField(String devId, Long chl,  Date startTime,  Date endTime, Pagination pagination);
    
    }

    1.2 XML 代码

      <select id="selectVideoByField"  resultMap="videoFileMap">
        SELECT file_id
        FROM t_device_file_info WHERE 1=1
        <trim>
          <if test="devId != null">
            AND dev_id=#{devId,jdbcType=VARCHAR}
          </if>
          <if test="chl != null">
            AND chl=#{chl,jdbcType=BIGINT}
          </if>
          <if test="startTime != null">
            AND start_time &gt;= #{startTime,jdbcType=TIMESTAMP}
          </if>
          <if test="endTime != null">
            AND end_time &lt;= #{endTime,jdbcType=TIMESTAMP}
          </if>
        </trim>
      </select>

    1.3 错误详情

    2. 解决方法

      在 Mapper 中定义的方法参数添加 @Param 注解,@Param 注解的值和xml中引用的参数名一致即可。

      @Param("devId"),则在xml中使用 #{devId}

    public interface DeviceFileInfoVOMapper {
    
        List<QueryFileDTO> selectVideoByField(@Param("devId") String devId, @Param("chl") Long chl, @Param("startTime")  Date startTime, @Param("endTime") Date endTime, Pagination pagination);
    
    }
  • 相关阅读:
    RESTful规范
    Vuex以及axios
    npm webpack vue-cli
    Vue生命周期
    Vue-Router
    Vue组件
    Vue基础以及指令
    1.JavaCC安装与测试
    10.InfluxDB-InfluxQL基础语法教程--OFFSET 和SOFFSET子句
    9.InfluxDB-InfluxQL基础语法教程--LIMIT and SLIMIT 子句
  • 原文地址:https://www.cnblogs.com/virgosnail/p/10831423.html
Copyright © 2011-2022 走看看