@param注解的作用
1.便于传多个参数 dao层示例: Public User selectUser(@param(“userName”) String name, @param(“userpassword”) String password);
对应的mapper.xml
select * from user_user_t where user_name = #{userName} and user_password=#{userPassword} 不使用@Param注解时,参数只能有一个,而且是JavaBean,在sql中只能引用JavaBean的属性。
2.类似于别名之类的功能 数据库中字段为:user_name、user_password; pojo类中字段为:name、password; 传参时别名字段为:userName,userPassword