mybatis中传入多个参数时,接口调用报错Parameter '*****' not found ...

 

报错:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException:

Parameter 'username' not found. Available parameters are [arg1, arg0, param1, param2]

问题代码:

@Select("select adminId,adminName,sex,tel,email,cardId,role from admin where adminId = #{username} and pwd = #{password}")
public Admin adminLogin(Integer username, String password);
解决办法:
@Select("select adminId,adminName,sex,tel,email,cardId,role from admin where adminId = #{username} and pwd = #{password}")
public Admin adminLogin(@Param("username")Integer username,@Param("password") String password);

 

posted @ 2020-09-13 16:37  adao  阅读(468)  评论(0编辑  收藏  举报