ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java
@@ -1,10 +1,7 @@
package com.ruoyi.demo.controller;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
@@ -16,7 +13,6 @@
 *
 * @author Lion Li
 */
@Api(value = "演示swagger3控制器", tags = {"演示swagger3接口"})
@RestController
@RequestMapping("/swagger/demo")
public class Swagger3DemoController {
@@ -24,13 +20,10 @@
    /**
     * 上传请求
     * 必须使用 @RequestPart 注解标注为文件
     * dataType 必须为 "java.io.File"
     *
     * @param file 文件
     */
    @ApiOperation(value = "通用上传请求")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true),
    })
    @PostMapping(value = "/upload")
    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public R<String> upload(@RequestPart("file") MultipartFile file) {
        return R.ok("操作成功", file.getOriginalFilename());
    }