Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
荆蔚杰
/
java.archive
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
084a502b
authored
2021-11-08 14:55:20 +0800
by
荆蔚杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
文件删除接口
1 parent
fc9fa5e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
src/main/java/com/pashanhoo/common/util/fileupload/FileController.java
src/main/java/com/pashanhoo/common/util/fileupload/FileController.java
View file @
084a502
...
...
@@ -4,10 +4,7 @@ import com.pashanhoo.common.Result;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestPart
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -24,7 +21,8 @@ public class FileController {
@Autowired
MinioUtil
minioUtil
;
@Autowired
MinioConfig
minioConfig
;
@RequestMapping
(
value
=
"/upload"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
"上传单个文件"
)
...
...
@@ -48,4 +46,15 @@ public class FileController {
}
}
@DeleteMapping
(
"/deleteFile"
)
@ApiOperation
(
"删除文件"
)
public
Result
deleteFile
(
@RequestParam
(
"saveUrl"
)
String
saveUrl
){
try
{
minioUtil
.
removeObject
(
minioConfig
.
getBucket
(),
saveUrl
);
return
Result
.
ok
();
}
catch
(
Exception
e
)
{
return
Result
.
exception
(
e
.
getMessage
());
}
}
}
...
...
Please
register
or
sign in
to post a comment