From 407f76da65b3a73877931cb7ae2518b92a8698da Mon Sep 17 00:00:00 2001 From: leebj Date: Wed, 19 Jun 2024 10:49:00 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=20=EC=88=98=EC=A0=95(URL=20=EC=BB=AC?= =?UTF-8?q?=EB=9F=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/adds/AddsMapperSupport.java | 15 +++++++++++++++ .../resources/sql/mapper/base/file-mapper.xml | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/cokr/xit/adds/AddsMapperSupport.java b/src/main/java/cokr/xit/adds/AddsMapperSupport.java index 79e1187..63163a5 100644 --- a/src/main/java/cokr/xit/adds/AddsMapperSupport.java +++ b/src/main/java/cokr/xit/adds/AddsMapperSupport.java @@ -7,9 +7,12 @@ import org.apache.ibatis.executor.Executor; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.plugin.Intercepts; import org.apache.ibatis.plugin.Signature; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; import cokr.xit.adds.core.util.CoreSpringUtils; import cokr.xit.base.FileController; +import cokr.xit.base.file.service.FileQuery; import cokr.xit.foundation.data.paging.MapperSupport; @Intercepts({ @@ -17,6 +20,18 @@ import cokr.xit.foundation.data.paging.MapperSupport; }) public class AddsMapperSupport extends MapperSupport { + @Override + protected Object query(Executor executor, MappedStatement mappedStatement, Object obj, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException { + String id = mappedStatement.getId(); + + if(id.equals("cokr.xit.base.file.dao.FileMapper.getFileList") + || id.equals("cokr.xit.base.file.dao.FileMapper.getFilesOf")) { + FileController addsFileController = CoreSpringUtils.getFileController(); + ((FileQuery)obj).setType(addsFileController.getFileRootPath()); + } + return super.query(executor, mappedStatement, obj, rowBounds, resultHandler); + } + @Override protected Object update(Executor executor, MappedStatement mappedStatement, Object obj) throws SQLException { String id = mappedStatement.getId(); diff --git a/src/main/resources/sql/mapper/base/file-mapper.xml b/src/main/resources/sql/mapper/base/file-mapper.xml index bc4dd29..a6299a0 100644 --- a/src/main/resources/sql/mapper/base/file-mapper.xml +++ b/src/main/resources/sql/mapper/base/file-mapper.xml @@ -33,7 +33,8 @@ -SELECT A.*, FILE_PATH URL +SELECT A.* + , REPLACE(FILE_PATH,#{type},'/files/') AS URL FROM TB_FILE A WHERE FILE_ID IN (#{fileID}) ORDER BY FILE_ID @@ -41,7 +42,8 @@ SELECT A.*, FILE_PATH URL -SELECT A.*, FILE_PATH URL +SELECT A.* + , REPLACE(FILE_PATH,#{type},'/files/') AS URL FROM TB_FILE A AND A.INF_TYPE = #{infoType}