昨天在写一个update方法修改制定用户的phone和address时,有三个参数
public void changeInf(String id,String phone,String address);
在xml中:
<update id="changeInf" parameterType="String">
update person set phone=#{phone},address=#{address} where id=#{id}
</update>
运行后报错,说找不到参数phone。
发现是因为有三个参数的原因,查了一下,将Mapper中的方法加上注解:
public void changeInf(@Param("id") String id, @Param("phone") String phone, @Param("address") String address);
再次运行,成功了~~