文件模块已完成
This commit is contained in:
@ -42,7 +42,7 @@ import java.util.List;
|
||||
* 文件 控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("fileInfo")
|
||||
@RequestMapping("file")
|
||||
@Slf4j
|
||||
@Tag(name = "文件管理")
|
||||
public class FileInfoController {
|
||||
@ -63,9 +63,9 @@ public class FileInfoController {
|
||||
@PostMapping("upload")
|
||||
@Operation(summary = "Web端文件上传(服务器)", description = "参数:文件添加请求体,权限:管理员,方法名:addFileInfo")
|
||||
@SysLog(title = "文件管理", content = "Web端文件上传(服务器)")
|
||||
public BaseResponse<String> uploadFile(@RequestPart("file") MultipartFile multipartFile, UploadFileRequest uploadFileRequest) {
|
||||
public BaseResponse<String> uploadFile(@RequestPart("file") MultipartFile multipartFile, UploadFileRequest uploadFileRequest) throws IOException{
|
||||
// 校验文件
|
||||
fileInfoService.validFile(multipartFile);
|
||||
fileInfoService.validFile(multipartFile, uploadFileRequest);
|
||||
// 文件上传
|
||||
String view = fileInfoService.uploadFile(multipartFile, uploadFileRequest);
|
||||
return ResultUtils.success(view, "上传成功");
|
||||
@ -77,13 +77,13 @@ public class FileInfoController {
|
||||
|
||||
/**
|
||||
* 文件下载(服务器)
|
||||
* @param filename 文件名
|
||||
* @param fileName 文件名
|
||||
* @throws IOException
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
@GetMapping("/download/{fileName}")
|
||||
@Operation(summary = "文件下载(服务器)", description = "参数:文件名,权限:所有人,方法名:downloadFile")
|
||||
public void downloadFile(@RequestParam @NotBlank String filename, HttpServletResponse response) throws IOException {
|
||||
fileInfoService.downloadFile(filename, response);
|
||||
public void downloadFile(@PathVariable @NotBlank String fileName, HttpServletResponse response) throws IOException {
|
||||
fileInfoService.downloadFile(fileName, response);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user