diff --git a/src/main/java/cokr/xit/base/file/dao/FileMapper.java b/src/main/java/cokr/xit/base/file/dao/FileMapper.java index a344462..2092f4b 100644 --- a/src/main/java/cokr/xit/base/file/dao/FileMapper.java +++ b/src/main/java/cokr/xit/base/file/dao/FileMapper.java @@ -2,7 +2,6 @@ package cokr.xit.base.file.dao; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; @@ -201,7 +200,7 @@ public interface FileMapper extends AbstractMapper { default int delete(List files) { if (isEmpty(files)) return 0; - String[] fileIDs = files.stream().map(FileInfo::getId).collect(Collectors.toList()).toArray(new String[files.size()]); + String[] fileIDs = files.stream().map(FileInfo::getId).toList().toArray(new String[files.size()]); return deleteFiles(params().set("fileIDs", ifEmpty(fileIDs, () -> null))); } } \ No newline at end of file diff --git a/src/main/java/cokr/xit/base/file/service/bean/FileBean.java b/src/main/java/cokr/xit/base/file/service/bean/FileBean.java index 56a74ea..6eb38f0 100644 --- a/src/main/java/cokr/xit/base/file/service/bean/FileBean.java +++ b/src/main/java/cokr/xit/base/file/service/bean/FileBean.java @@ -183,7 +183,7 @@ public class FileBean extends AbstractBean { */ public int deleteOf(String infoType, String... infoKeys) { List files = getFilesOf(infoType, infoKeys); - if (delete(files) < 1) return 0; + delete(files); return fileMapper.delete(files); } @@ -194,7 +194,7 @@ public class FileBean extends AbstractBean { */ public int deleteByIDs(String... fileIDs) { List files = getFiles(fileIDs); - if (delete(files) < 1) return 0; + delete(files); return fileMapper.delete(files); } @@ -207,8 +207,12 @@ public class FileBean extends AbstractBean { if (isEmpty(files)) return 0; int affected = 0; - for (FileInfo file: files) - affected += file.delete() ? 1 : 0; + for (FileInfo file: files) { + if (file.delete()) + ++affected; + else + log().warn("Failed to delete {}({})", file.getPath(), file.getId()); + } return affected; }