記一下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測試后后端會多一個雙引號

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM