Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2]

Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2]

原因:传递的参数超过一个

解决办法:

(1)直接把值改成数字

<select id="LoginUser" parameterType="String" resultMap="userMap">
  SELECT * FROM user where emplnumb = #{0} and password=#{1}
</select>

(2)在变量上加注解@Param

Public User selectUser(@param(“userName”) String name,@param (“userpassword”) 

  

public List<user> getUserInformation(@Param("user") User user);

  

posted @ 2018-01-13 14:47  巴_卫  阅读(14429)  评论(0编辑  收藏  举报