提交 | 用户 | 时间
|
722af2
|
1 |
package com.dl.demo.controller; |
X |
2 |
|
|
3 |
import com.dl.common.core.domain.R; |
|
4 |
import org.springframework.http.MediaType; |
|
5 |
import org.springframework.web.bind.annotation.PostMapping; |
|
6 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
7 |
import org.springframework.web.bind.annotation.RequestPart; |
|
8 |
import org.springframework.web.bind.annotation.RestController; |
|
9 |
import org.springframework.web.multipart.MultipartFile; |
|
10 |
|
|
11 |
/** |
|
12 |
* swagger3 用法示例 |
|
13 |
* |
|
14 |
* @author Lion Li |
|
15 |
*/ |
|
16 |
@RestController |
|
17 |
@RequestMapping("/swagger/demo") |
|
18 |
public class Swagger3DemoController { |
|
19 |
|
|
20 |
/** |
|
21 |
* 上传请求 |
|
22 |
* 必须使用 @RequestPart 注解标注为文件 |
|
23 |
* |
|
24 |
* @param file 文件 |
|
25 |
*/ |
|
26 |
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
27 |
public R<String> upload(@RequestPart("file") MultipartFile file) { |
|
28 |
return R.ok("操作成功", file.getOriginalFilename()); |
|
29 |
} |
|
30 |
|
|
31 |
} |