美文网首页
Spring boot 接收数组

Spring boot 接收数组

作者: 虫儿飞ZLEI | 来源:发表于2019-02-28 14:30 被阅读0次

前端ajax传参发请求:

$.ajax({
                    url:'/tjcx/qyzxcx/cwzb/gjcwzb',
                    type:'post',
                    data:{
                        'djxh':djxh,
                        'nds':app.lastYears
                    },
                    success:function (res) {
                        let data = res.data;
                        if (data.code === 200) {
                            app.tableData6 = data.data;
                        }
                    }
                })

发出的数组叫nds

接收:

    @ApiOperation("查询财务报表数据")
    @PostMapping("/gjcwzb")
    public ApiResponse getDataByDjxh(@RequestParam("djxh") @ApiParam(name = "djxh", value = "登记序号", required = true) String djxh,
                                     @RequestParam("nds[]") @ApiParam(name = "nds[]", value = "最近三年数组", required = true) String[] nds) {

        logger.info("请求->查询财务报表数据->输入参数【djxh:" + djxh + ",nds:" + nds + "】");

接收的时候,@RequestParam不能用nds接收,要用nds[]接收

相关文章

网友评论

      本文标题:Spring boot 接收数组

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