From f6fdb8a2286049b9f12003864e949d27e7e7b1b7 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Wed, 3 Jul 2024 09:53:01 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cokr/xit/base/file/dao/FileMapper.java | 3 +-- .../cokr/xit/base/file/service/bean/FileBean.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) 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; }