@Postmapping 使用 json 传输参数list (两种方法接收)
作者:互联网
PostMan 参数如图:
@RestController @RequestMapping("/sys/mytest") public class SysMytestController extends BaseController {
//方法1
@PostMapping("/save1")public Result save(@Validated @RequestBody Map<String,Object> mapList) { String v1=mapList.get("v1").toString(); String v2=mapList.get("v2").toString(); return Result.succ(""); }
//方法2
@PostMapping("/save2") public Result save1(@RequestBody JSONObject params ) { String v1 = params.get("v1").toString(); String v2 = params.get("v2").toString(); return Result.succ(""); }
标签:String,get,list,v2,Postmapping,v1,json,toString,Result 来源: https://www.cnblogs.com/janus2003/p/15795145.html