医院废弃物信息化管理平台
“mitao”
2025-12-24 3763145f34d7706923d55edc32f5cfbc8bc08b92
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cn.besteam.modules.system.controller;
 
import cn.besteam.common.api.vo.Result;
import cn.besteam.common.constant.ErrorCode;
import cn.besteam.common.exception.BusinessException;
import cn.besteam.modules.system.service.IOssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
@RestController
@RequestMapping("/file")
@Api(value = "文件管理")
public class FileController {
 
    @Autowired
    private IOssService ossService;
 
    @PostMapping("/upload")
    @ApiOperation(value = "上传文件")
    public Result<String> upload(MultipartFile file) {
 
        if (file == null) {
            throw new BusinessException(ErrorCode.SYSTEM_REQUEST_PARAM_ERROR);
        }
        String fileUrl = ossService.upload(file);
        return Result.ok(fileUrl);
    }
 
}