1--- @Param注解
/*当你使用了使用@Param注解来声明参数时,如果使用 # 或 $ 的方式都可以。
@Select("select column from table where userid = ${userid} ")
public int selectColumn(@Param("userid") int userid);
当你不使用@Param注解来声明参数时,必须使用使用 #方式
*/
@Select("select * from user where id=#{id}")
User getUserById(@Param("id") Integer id);
2---@PathVariable注解;@PathVariable 映射 URL 绑定的占位符
通过 @PathVariable 可以将 URL 中占位符参数绑定到控制器处理方法的入参中:
URL 中的 {xxx} 占位符可以通过@PathVariable(“xxx“) 绑定到操作方法的入参中。
@GetMapping("/deleteUser/{id}")
public Result deleteUser(@PathVariable("id") Integer id) {
}
此时网络请求中使用的是:http://localhost:8080/deleteUser/3
若不使用这个注解,则请求时使用正常的参数进行请求:
3---Data注解:注意,要自己生成有参构造器和无参构造器的方法
所有属性的get和set方法
toString 方法
hashCode方法
equals方法