파일관련SQL에서 로컬 경로 하드코딩 제거

dev
이범준 6 months ago
parent e41fa7ba18
commit f1b1b77031

@ -20,21 +20,24 @@
</resultMap> </resultMap>
<sql id="fileDirs">SELECT INF_TYPE <sql id="fileDirs">SELECT INF_TYPE
, CONCAT('C://workspace/xit/base/files/', DIR, DATE_FORMAT(CURRENT_DATE, '%Y/%m/%d/')) DIR , CONCAT('files/', DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR
FROM ( FROM (
SELECT '00' INF_TYPE, 'attachment/' DIR FROM DUAL UNION SELECT '00' INF_TYPE, 'attachment/' DIR FROM DUAL UNION
SELECT '01' INF_TYPE, 'document/' DIR FROM DUAL UNION SELECT '01' INF_TYPE, 'document/' DIR FROM DUAL UNION
SELECT '02' INF_TYPE, 'article/' DIR FROM DUAL SELECT '02' INF_TYPE, 'article/' DIR FROM DUAL UNION
) FILE_DIRS</sql>
SELECT '100' INF_TYPE, 'attachment/dsuse' DIR FROM DUAL
SELECT '110' INF_TYPE, 'document/dsuse' DIR FROM DUAL
) FILE_DIRS</sql>
<sql id="selectFiles"> <sql id="selectFiles">
<if test="fileIDs != null"> <if test="fileIDs != null">
SELECT A.*, REPLACE(FILE_PATH, 'C://workspace/xit/base', '') URL SELECT A.*, FILE_PATH URL
FROM TB_FILE A FROM TB_FILE A
WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>) WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)
ORDER BY FILE_ID</if> ORDER BY FILE_ID</if>
<if test="fileIDs == null"><include refid="utility.paging-prefix" /> <if test="fileIDs == null"><include refid="utility.paging-prefix" />
SELECT A.*, REPLACE(FILE_PATH, 'C://workspace/xit/base', '') URL SELECT A.*, FILE_PATH URL
FROM TB_FILE A FROM TB_FILE A
<where> <where>
<if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if> <if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if>

Loading…
Cancel
Save