|
@@ -8,14 +8,17 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
|
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
|
-import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
|
|
-import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileRespVO;
|
|
|
-import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileUploadReqVO;
|
|
|
+import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.*;
|
|
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
|
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import jakarta.annotation.security.PermitAll;
|
|
|
+import jakarta.servlet.http.HttpServletRequest;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import jakarta.validation.Valid;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -23,12 +26,6 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import jakarta.annotation.Resource;
|
|
|
-import jakarta.annotation.security.PermitAll;
|
|
|
-import jakarta.servlet.http.HttpServletRequest;
|
|
|
-import jakarta.servlet.http.HttpServletResponse;
|
|
|
-import jakarta.validation.Valid;
|
|
|
-
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
@Tag(name = "管理后台 - 文件存储")
|
|
@@ -50,6 +47,18 @@ public class FileController {
|
|
|
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/presigned-url")
|
|
|
+ @Operation(summary = "获取文件预签名地址")
|
|
|
+ public CommonResult<FilePresignedUrlRespVO> getFilePresignedUrl(@RequestParam("fileName") String fileName) throws Exception {
|
|
|
+ return success(fileService.getFilePresignedUrl(fileName));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建文件")
|
|
|
+ public CommonResult<Long> createFile(@Valid @RequestBody FileCreateReqVO createReqVO) {
|
|
|
+ return success(fileService.createFile(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
@DeleteMapping("/delete")
|
|
|
@Operation(summary = "删除文件")
|
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
@@ -62,7 +71,7 @@ public class FileController {
|
|
|
@GetMapping("/{configId}/get/**")
|
|
|
@PermitAll
|
|
|
@Operation(summary = "下载文件")
|
|
|
- @Parameter(name = "configId", description = "配置编号", required = true)
|
|
|
+ @Parameter(name = "configId", description = "配置编号", required = true)
|
|
|
public void getFileContent(HttpServletRequest request,
|
|
|
HttpServletResponse response,
|
|
|
@PathVariable("configId") Long configId) throws Exception {
|