Swagger2使用记录

1.传入多个参数的时候使用@ApiImplicitParams注解

 @ApiImplicitParams({
            @ApiImplicitParam(name = "userId",value = "用户id",required = true,dataType = "String",paramType = "query"),
            @ApiImplicitParam(name = "bgmId",value = "Bgmid",required = true,dataType = "String",paramType = "query"),
            @ApiImplicitParam(name = "videoSeconds",value = "视频长度参数",required = true,dataType = "String",paramType = "query"),
            @ApiImplicitParam(name = "videoHeight",value = "视频画面高度参数",required = true,dataType = "String",paramType = "query"),
            @ApiImplicitParam(name = "videoWidth",value = "视频画面宽度参数",required = true,dataType = "String",paramType = "query"),
            @ApiImplicitParam(name = "desc",value = "视频描述",required = false,dataType = "String",paramType = "query")

    })

上传视频的后台接口
 @PostMapping("/uploadvideo")
    public IMoocJSONResult uploadVideo(String userId,String bgmId,double videoSeconds,int videoHeight,int videoWidth,
                                       String desc,
                                       @RequestParam("file") MultipartFile files) throws Exception{
            return IMoocJSONResult.ok();
    }

required:是否为必填项目,true 是, false 否;value:Swagger页面现实参数的名称解释;

你可能感兴趣的:(Swagger2使用记录)