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

修改前的代码:

	@Select("select * from fruitsell where f_id=#{f_id} and u_id=#{u_id}")
	public Fruitsell finbyfruitsell(Long f_id,Long u_id);

修改后的代码:

	@Select("select * from fruitsell where f_id=#{0} and u_id=#{1}")
	public Fruitsell finbyfruitsell(Long f_id,Long u_id);




总结:原本用的是名称匹配发现不可以,我就换成了0、1、2、3这样的方式序列匹配。

如果还是解决不了的话可能是参数类型不一致或者其中参数为NULL。


后续补充

 错误 : ${Name}
正确:${name}

因为EL是读取属性的getter方法的,一般按照属性首字母小写来处理.


2018年3月更新=======

之前写的方法有好多问题,现在更新在更新一下 

	@Select("select * from fruitsell where f_id=#{f_id} and u_id=#{u_id}")
	public Fruitsell finbyfruitsell(@Param("f_id") Long f_id,@Param("f_id") Long u_id);
加一个@ Param注解就可以了

猜你喜欢

转载自blog.csdn.net/u012149181/article/details/80427411