Parameter 'name' not found. Available parameters are [1, 0, param1, param2]
这是mybatis接收多种参数时存在的问题。
解决方案:
1. 使用索引下标
接口中的方法
public int select(String name,String password);
xml文件
<select id="select" parameterType="string" resultType="int">
select count(id) from tb_user where name=#{0} and password=#{1}
</select>
2. 使用注解@Param
接口中的方法
public int select(@Param("name")String name,@Param("password")String password);
xml文件
<select id="select" parameterType="string" resultType="int">
select count(id) from tb_user where name=#{name,jdbcType=VARCHAR} and password=#{password,jdbcType=VARCHAR}
</select>