mybatis错误笔记

2020-03-31  本文已影响0人  我是电饭煲

The last packet successfully received from the server was 359,978 milliseconds ago.

url: jdbc:mysql://localhost:3306/mht_web?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai

Available parameters are [arg1, arg0, param1, param2]

解决办法
a. 使用#{arg0}
使用#{arg0}和#{arg1}来告诉mybatis,当前变量使用哪个参数的值
<select id="findByNameAndPsd" parameterType="User" resultType="User">
SELECT * FROM user WHERE username = #{arg0} AND password = #{arg1}
</select>
b.使用注解@Param
List<User> findByNameAndPsd(@Param("username") String username,@Param("password")String password);
https://blog.csdn.net/zzzgd_666/article/details/81811332

上一篇下一篇

猜你喜欢

热点阅读