美文网首页
postman springmvc post 传递集合

postman springmvc post 传递集合

作者: 一个冬季 | 来源:发表于2018-08-02 00:14 被阅读83次

需要传递的JSON集合对象

[
        {
            "id": 1,
            "pdpc": "1",
            "sprq": "2018-08-01 00:00:25.977",
            "zcId": 1,
            "zcbh": "111111111111111111",
            "zcmc": "张三",
            "pdbs": "已标记",
            "isNewAdd": 0
        },
        {
            "id": 4,
            "pdpc": "1",
            "sprq": "2018-08-01 00:00:26.0",
            "zcId": 1,
            "zcbh": "111111111111111112",
            "zcmc": "张三2",
            "pdbs": "已标记",
            "isNewAdd": 0
        }
    ]

注意不要多写 "list" ..... 多写了就不行,我不知道为啥。。。如果我还要多传递名称为 user的对象呢?这个怎么弄?搞不懂


head.png
body.png

后台代码

 @ResponseBody  
    @RequestMapping(value="/upPanDian",method={RequestMethod.POST})  
    public BaseObject upPanDian(@RequestBody List<InvestmentCheck> list) throws Exception{  
        BaseObject baseObj = new BaseObject();
        if(list==null || list.size()<=0){
            baseObj.setCode(1);
            baseObj.setErrorMessage("集合参数为空");
            return baseObj;
        }
        List<Integer> integers = investService.updateInvesent(list);
        baseObj.setCode(0);
        baseObj.setData(integers);
        return baseObj;
    }  

InvestmentCheck里面的属性就是我要传递的参数属性

博客参考文章
postman+json+springmvc测试批量添加

相关文章

网友评论

      本文标题:postman springmvc post 传递集合

      本文链接:https://www.haomeiwen.com/subject/bcbdvftx.html