From 438fb0a1e4b9eb73642cedbd04cce21dcb1b4478 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Mon, 3 Jun 2024 16:40:22 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20file=20upload=EC=8B=9C=20=EA=B8=B0?= =?UTF-8?q?=EC=A1=B4=20=ED=8C=8C=EC=9D=BC(=EC=A0=95=EB=B3=B4)=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=ED=9B=84=20=EC=97=85=EB=A1=9C=EB=93=9C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java | 2 +- .../adds/biz/nims/service/bean/BizNimsServiceBean.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java b/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java index 4fc07a7..dd02dfd 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java +++ b/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java @@ -70,7 +70,7 @@ public interface BizNimsMapper extends AbstractMapper { NimsApiDto.DsuseRptInfo selectDsuseRptInfoByUsrRptIdNo(final Map map); // 이미지 업로드시 이전 이미지 삭제를 위한 fileId 조회 - String selectFileId(Map map); + List selectFileId(Map map); //List selectDsuseRptInfoDtls(final Map map); diff --git a/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java b/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java index cf3c477..c51c9ef 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java +++ b/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java @@ -1,7 +1,7 @@ package cokr.xit.adds.biz.nims.service.bean; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -985,12 +985,12 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe * */ private String uploadFileAndSave(String infType, String infKey, String subType, MultipartFile mf) { - String fileId = bizNimsMapper.selectFileId(Map.of("infType", infType, "infKey", infKey, "subType", subType)); - if(!isEmpty(fileId)){ - fileService.delete(new String[]{fileId}); + List fileIds = bizNimsMapper.selectFileId(Map.of("infType", infType, "infKey", infKey, "subType", subType)); + if(!fileIds.isEmpty()){ + fileService.delete(fileIds.toArray(new String[0])); } - MultipartFile[] uploads = Arrays.asList(mf).toArray(new MultipartFile[0]); + MultipartFile[] uploads = Collections.singletonList(mf).toArray(new MultipartFile[0]); List files = (new FileInfoFactory()).makeFileInfos((new FileInfo.Relation()).setInfoType(infType).setInfoKey(infKey).setSubType(subType), uploads); fileService.create(files);