标签:restful string map spring rest lse required ppi mapping
GET请求:
1.restful风格:
@GetMapping("/order/detail") public BaseOutput omsQueryDetail(@RequestParam("orderId") String id) { }
2.resultful风格:
@GetMapping("/order/detail/{orderId}") public BaseOutput omsQueryDetail(@PathVariable String orderId) { }
POST请求:
@PostMapping("/order/detail") public BaseOutput orderDetail(@RequestBody OrderDetailReq req) { }
一些情况:
1.使用@RequestParam,参数不一定存在时
@RequestParam(name="id",required=false)
@RequestParam(name="id",required=false,defaultValue="0")
标签:restful string map spring rest lse required ppi mapping
原文地址:https://www.cnblogs.com/one-apple-pie/p/request-example.html