mybatis 3.0.0+

public interface Mapper {
  String select(@Param("a") String s);
  String select(@Param("b") Integer i);
}
  <select id="select" parameterType="map" ..>
    SELECT *
    FROM testtable
    <where>    
    <if test="a != null">
        a_field like #{a}   
    </if>
    <if test="b != null">
        b_field > #{b}
    </if>
  </where>
  </select>

I've got for Mapper#select(1) this:

org.apache.ibatis.binding.BindingException: Parameter 'a' not found. Available parameters are [param1, b]

due to this org/apache/ibatis/binding/MapperMethod.java:168 or this /org/apache/ibatis/session/defaults/DefaultSqlSession.java:294

Could u remove this annoing check or make flag to disable it?

Comment From: harawata

Hi,

MyBatis does not support method overloading, unfortunately. The closest solution I can think of is to define the method with two parameters.

public interface Mapper {
  String select(@Param("a") String s, @Param("b") Integer i);
}

Comment From: yunkaiOr2

i defined a trim <trim prefix="SET" suffixOverrides=","> <if test="couponId != null"> coupon_id = #{couponId,jdbcType=VARCHAR}, </if> <if test="orderId != null"> order_id = #{orderId,jdbcType=VARCHAR}, </if> <if test="telephone != null"> telephone = #{telephone,jdbcType=VARCHAR}, </if> </trim> now defined a method -> update(@Param("orderId") String orderId) throw a exceptioin org.apache.ibatis.binding.BindingException: Parameter 'couponId' not found

Comment From: tsuixh

i defined a trim <trim prefix="SET" suffixOverrides=","> <if test="couponId != null"> coupon_id = #{couponId,jdbcType=VARCHAR}, </if> <if test="orderId != null"> order_id = #{orderId,jdbcType=VARCHAR}, </if> <if test="telephone != null"> telephone = #{telephone,jdbcType=VARCHAR}, </if> </trim> now defined a method -> update(@param("orderId") String orderId) throw a exceptioin org.apache.ibatis.binding.BindingException: Parameter 'couponId' not found

I have the same problem, have you solved it?

Comment From: tinarooot

解决了吗

Comment From: geekyouth

https://blog.csdn.net/weixin_53907265/article/details/120993421 BindingException: Parameter ‘...‘ not found. Available parameters are [arg1, arg0, param1, para

https://github.com/mybatis/mybatis-3/issues/2591#issuecomment-1172200488 https://qiita.com/kazuki43zoo/items/c0603931c9f0a655a9a4#intellij-idea-1