url带?
http://ip:port/user/selectuserbyid?user_id=1
/**
* @param user_id
* @return loginResultdto
* @description 根据id查询用户
* @date 2022-03-17
*/
@ApiOperation(value = "根据id查询用户", notes = "根据id查询用户", httpMethod = "GET", response = UserResultdto.class)
@RequestMapping(method = RequestMethod.GET, value = "/selectuserbyid")
public CommonResult selectUserById(@RequestParam("user_id") int user_id) {
User res = iUserService.selectUserById(user_id);
if (res != null) {
//数据库查询成功
return CommonResult.success(new UserResultdto(res), "查询成功");
} else {
return CommonResult.failed("参数错误");
}
}
url/后直接是数据
@RestController
public class HelloController {
@GetMapping("/hello/{name}")
public String hello(@PathVariable("name") String name){
return "你好," + name + " !";
}
}