|
@@ -97,16 +97,15 @@ public class FilesService extends BaseService<FilesMapper, Files> implements IFi
|
|
|
|
|
|
@Override
|
|
|
public boolean deleteFile(List<String> ids) {
|
|
|
-
|
|
|
List<Files> files = filesMapper.selectListByIds(ids);
|
|
|
if (ObjectUtil.isEmpty(files)) {
|
|
|
- return false;
|
|
|
+ throw new BusinessException("文件不存在");
|
|
|
}
|
|
|
- files.forEach(filesInfo -> {
|
|
|
+ files.forEach(file -> {
|
|
|
try {
|
|
|
- FileLocalUtils.deleteFile(filesInfo.getStorageUrl());
|
|
|
+ FileLocalUtils.deleteFile(file.getStorageUrl());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("文件删除失败:{},路径:{}", filesInfo.getOriginalName(), filesInfo.getStorageUrl(), e);
|
|
|
+ log.error("文件删除失败:{},路径:{}", file.getOriginalName(), file.getStorageUrl(), e);
|
|
|
throw new BusinessException("文件删除失败");
|
|
|
}
|
|
|
});
|