提交 b9eda9bc authored 作者: 任建彩's avatar 任建彩

feat:删除文件

1.file
上级 1fa921f8
......@@ -114,7 +114,7 @@ public class FileController {
// 处理文件上传
@ApiOperation(value = "删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
public CallBack<Boolean> delete(@RequestBody List<String> fileName){
public CallBack<Boolean> delete(@RequestBody List<String> fileName) throws IOException {
String filePath = null;
if (fileName.size()>0) {
LambdaQueryWrapper<FileInfo> queryWrapper = new LambdaQueryWrapper<>();
......@@ -126,14 +126,10 @@ public class FileController {
}
filePath = rootPath+entity.getPath()+"/"+entity.getFileName()+entity.getSuffixName();
String path = entity.getPath()+"/"+entity.getFileName();
/* //删除源文件
String[] cmd = new String[] { "/bin/sh", "-c", "rm -rf "+filePath };
try{
Process process = Runtime.getRuntime().exec(cmd);
}catch(IOException e){
e.printStackTrace();
throw new FileBizException("删除失败!");
}
/*if (service.removeById(entity.getId())) {
Process process = Runtime.getRuntime().exec(cmd);*/
if (service.removeById(entity.getId())) {
//删除源文件
File file = new File(filePath);
file.delete();
......@@ -147,7 +143,7 @@ public class FileController {
if (file2.exists() && file2.isFile()) {
file2.delete();
}
}*/
}
}
}
return CallBack.success(true);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论