记一下post请求文件和对象一起传输(form表单提交)swagger显示问题

1.swagger的form表单提交文件和对象

@PostMapping(value = "/{id}/secondPage", headers = "content-type=multipart/form-data")
@ApiOperation(httpMethod = "POST", value = "字段1,字段2,字段3/文件导入(包括增加/更新)")
@ApiImplicitParams({
        @ApiImplicitParam(name = "file", value = "excel文件", required = false, paramType = "form", dataType = "__file"),
        @ApiImplicitParam(name = "channelList", value = "字段1", required = true, paramType = "form", allowMultiple = true, dataType = "string"),
        @ApiImplicitParam(name = "organList", value = "字段2", required = true, paramType = "form", allowMultiple = true, dataType = "string"),
        @ApiImplicitParam(name = "accountList", value = "字段3", required = false, paramType = "form", allowMultiple = true, dataType = "string"),
        @ApiImplicitParam(name = "organIdList", value = "字段4", required = false, paramType = "form", allowMultiple = true, dataType = "string")
})
public ResponseData createLearningPlanSecond(@ApiParam(name = "id", value = "学习计划ID", required = true) @PathVariable(required = true) String id,
                                             @ApiParam(name = "format", value = "字段1,字段2,字段3/文件导入(包括增加/更新)", required = true) @RequestParam(required = true) Integer format,
                                             @ApiParam(name = "secondDto", value = "第二页数据:字段1/字段2/字段3(选择/文件导入)") @Valid @ModelAttribute LearningPlanSecondDTO secondDto) {
    return Result.ok(learningPlanService.createLearningPlanSecond(id, secondDto, format));
}

 

2.使用swagger测试后后端会多一个双引号

 

posted @ 2020-09-11 16:05  卡不搬砖  阅读(3957)  评论(0)    收藏  举报