@GetMapping和@PostMapping的区别

@GetMapping:
直接从URL获得数据,以www.xxx.com/?id=1类似这种形式传输。
举例:
在这里插入图片描述

这个URL中,请求来到后端,并且是一个Get方法,那么selectById就会接受到一个id=1这样的参数
@PostMapping
请求会从body部分拿到数据,好处是一些不希望用户看到的数据会放在body里面传输。
举例
在这里插入图片描述
这个post方法,pageNum和pageSize数据都在body里面而不是在url里

猜你喜欢

转载自blog.csdn.net/qq_42685588/article/details/107831654