|
|
@@ -82,7 +82,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "创建文件夹")
|
|
|
@PostMapping(value = "/folder")
|
|
|
- public Result<FolderDTO> createFolder(FolderSaveDTO newFolder) {
|
|
|
+ public Result<FolderDTO> createFolder(@RequestBody FolderSaveDTO newFolder) {
|
|
|
BizAssert.notNull(newFolder.getName(), ExceptionCode.FOLDER_NAME_EMPTY);
|
|
|
// 检查父文件夹
|
|
|
FileInfo parent = checkFolder(newFolder.getFolderId());
|
|
|
@@ -93,7 +93,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "上传文件")
|
|
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
|
- public Result<FileInfoDTO> upload(Long folderId, @RequestPart(value = "file") MultipartFile file) throws Exception {
|
|
|
+ public Result<FileInfoDTO> upload(@RequestParam("folderId") Long folderId, @RequestPart(value = "file") MultipartFile file) throws Exception {
|
|
|
// 检查父文件夹
|
|
|
FileInfo parent = checkFolder(folderId);
|
|
|
FileInfo info = FileInfo.newFile(file).folder(parent.getId())
|
|
|
@@ -104,7 +104,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "下载文件")
|
|
|
@GetMapping(value = "/download/{id}")
|
|
|
- public void download(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
|
|
+ public void download(@PathVariable("id") Long id, HttpServletResponse response) throws Exception {
|
|
|
FileInfo info = fileService.findByPrimaryKey(id);
|
|
|
if (null == info) {
|
|
|
throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
|
|
|
@@ -135,7 +135,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "下载文件")
|
|
|
@GetMapping(value = "/download")
|
|
|
- public void download(@RequestParam String path, HttpServletResponse response) throws Exception {
|
|
|
+ public void download(@RequestParam("path") String path, HttpServletResponse response) throws Exception {
|
|
|
FileInfo info = fileService.findByFullPath(path);
|
|
|
if (null == info) {
|
|
|
throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
|
|
|
@@ -145,7 +145,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "查看文件")
|
|
|
@GetMapping(value = "/view/{id}")
|
|
|
- public void view(@PathVariable Long id, HttpServletResponse response) throws Exception {
|
|
|
+ public void view(@PathVariable("id") Long id, HttpServletResponse response) throws Exception {
|
|
|
FileInfo info = fileService.findByPrimaryKey(id);
|
|
|
if (null == info) {
|
|
|
throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
|
|
|
@@ -169,7 +169,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "查看文件")
|
|
|
@GetMapping(value = "/view")
|
|
|
- public void view(@RequestParam String path, HttpServletResponse response) throws Exception {
|
|
|
+ public void view(@RequestParam("path") String path, HttpServletResponse response) throws Exception {
|
|
|
FileInfo info = fileService.findByFullPath(path);
|
|
|
if (null == info) {
|
|
|
throw new BizException(ExceptionCode.FILE_NOT_EXISTS);
|
|
|
@@ -179,7 +179,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "查看文件信息")
|
|
|
@GetMapping(value = "/info/{id}")
|
|
|
- public Result<FileInfoDTO> getFileInfo(@PathVariable Long id) {
|
|
|
+ public Result<FileInfoDTO> getFileInfo(@PathVariable("id") Long id) {
|
|
|
FileInfo info = fileService.findByPrimaryKey(id);
|
|
|
if (null != info) {
|
|
|
return Result.success(BeanMapper.map(info, FileInfoDTO.class));
|
|
|
@@ -189,7 +189,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "查看文件信息")
|
|
|
@GetMapping(value = "/info")
|
|
|
- public Result<FileInfoDTO> getFileInfo(@RequestParam String path) {
|
|
|
+ public Result<FileInfoDTO> getFileInfo(@RequestParam("path") String path) {
|
|
|
FileInfo info = fileService.findByFullPath(path);
|
|
|
if (null != info) {
|
|
|
return Result.success(BeanMapper.map(info, FileInfoDTO.class));
|
|
|
@@ -199,7 +199,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "查看子文件")
|
|
|
@GetMapping(value = "/list")
|
|
|
- public Result<List<FileInfoDTO>> listFiles(Long folderId) {
|
|
|
+ public Result<List<FileInfoDTO>> listFiles(@RequestParam("folderId") Long folderId) {
|
|
|
List<FileInfo> files = fileService.findByFolderId(checkFolder(folderId).getId());
|
|
|
return Result.success(BeanMapper.mapList(files, FileInfoDTO.class));
|
|
|
}
|
|
|
@@ -287,8 +287,8 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "删除文件")
|
|
|
@GetMapping(value = "/delete/{id}")
|
|
|
- public Result delete(@PathVariable Long id,
|
|
|
- @RequestParam(required = false, defaultValue = "false") Boolean purge) {
|
|
|
+ public Result delete(@PathVariable("id") Long id,
|
|
|
+ @RequestParam(required = false, defaultValue = "false", value = "purge") Boolean purge) {
|
|
|
FileInfo info = fileService.findByPrimaryKey(id);
|
|
|
if (null != info) {
|
|
|
if (purge) {
|
|
|
@@ -302,8 +302,8 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "删除文件")
|
|
|
@GetMapping(value = "/delete")
|
|
|
- public Result delete(@RequestParam String path,
|
|
|
- @RequestParam(required = false, defaultValue = "false") Boolean purge) {
|
|
|
+ public Result delete(@RequestParam("id") String path,
|
|
|
+ @RequestParam(required = false, defaultValue = "false", value = "purge") Boolean purge) {
|
|
|
FileInfo info = fileService.findByFullPath(path);
|
|
|
if (null != info) {
|
|
|
if (purge) {
|
|
|
@@ -317,7 +317,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "还原文件")
|
|
|
@GetMapping(value = "/restore/{id}")
|
|
|
- public Result restore(@PathVariable Long id) {
|
|
|
+ public Result restore(@PathVariable("id") Long id) {
|
|
|
FileInfo info = fileService.findByPrimaryKey(id);
|
|
|
if (null != info) {
|
|
|
cascadeRestore(info);
|
|
|
@@ -327,7 +327,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "还原文件")
|
|
|
@GetMapping(value = "/restore")
|
|
|
- public Result restore(@RequestParam String path) {
|
|
|
+ public Result restore(@RequestParam("path") String path) {
|
|
|
FileInfo info = fileService.findByFullPath(path);
|
|
|
if (null != info) {
|
|
|
cascadeRestore(info);
|
|
|
@@ -337,7 +337,7 @@ public class FileController {
|
|
|
|
|
|
@ApiOperation(value = "移动文件到文件夹")
|
|
|
@GetMapping(value = "/move")
|
|
|
- public Result move(@RequestParam Long fileId, @RequestParam Long folderId) {
|
|
|
+ public Result move(@RequestParam("fileId") Long fileId, @RequestParam("folderId") Long folderId) {
|
|
|
FileInfo info = fileService.findByPrimaryKey(fileId);
|
|
|
if (null != info) {
|
|
|
info.setFolderId(folderId);
|