异常问题:org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [arg1, arg0, param1, param2]
### Cause: org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [arg1, arg0, param1, param2]
产生原因:当出现多个参数时,mybatis会将这些参数封存到map集合里面,故需要使用mybatis提供的参数来获取[arg1, arg0, param1, param2]
解决方法:将原来mapper.xml文件中的
select * from admin where username=#{username} and password=#{password}
改为
select * from admin where username=#{arg0} and password=#{arg1}
或者
select * from admin where username=#{param1} and password=#{param2}
亦或者
select * from admin where username=#{arg0} and password=#{param2}
select * from admin where username=#{param1} and password=#{arg1}