我这里的报错信息显示:

org.apache.ibatis.binding.BindingException: Parameter 'reqUsername' not found. Available parameters are [0, 1, param1, param2]

原因:当只有一个参数时,Mapper中可以不使用@Param,但是当有多个参数的时候,要使用@Param。

原来的代码:

	@Select("select * from tz_user where " + GlobalConfigure.USER_AUTH_SQL_SUFFIX)
	List<User> getAllUser(String reqUsername, String reqPasswd);

改成:

	@Select("select * from tz_user where " + GlobalConfigure.USER_AUTH_SQL_SUFFIX)
	List<User> getAllUser(@Param("reqUsername") String reqUsername, @Param("reqPasswd") String reqPasswd);

就成功返回结果了。

相关文章:

  • 2021-06-29
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案