fileDir, fileUrl 분리

dev
이범준 4 months ago
parent 97b8e131fe
commit 5004c22d18

@ -19,8 +19,16 @@
<result property="useYN" column="USE_YN"/> <result property="useYN" column="USE_YN"/>
</resultMap> </resultMap>
<sql id="fileDirs">SELECT INF_TYPE <sql id="fileDir">CONCAT(#{addsFileRootPath}, DIR, DATE_FORMAT(CURRENT_DATE, '%Y/%m/%d/'))</sql>
, CONCAT(#{addsFileRootPath}, DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR <sql id="fileUrl">(CASE
WHEN REPLACE(FILE_PATH,#{type},'/files/') LIKE '_:%'
THEN SUBSTR(REPLACE(FILE_PATH,#{type},'/files/'),3)
ELSE REPLACE(FILE_PATH,#{type},'/files/')
END)</sql>
<sql id="fileDirs">
SELECT INF_TYPE
,<include refid="cokr.xit.base.file.dao.FileMapper.fileDir" /> 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
@ -34,7 +42,7 @@
<sql id="selectFiles"> <sql id="selectFiles">
<if test="fileIDs != null"> <if test="fileIDs != null">
SELECT A.* SELECT A.*
, REPLACE(FILE_PATH,#{type},'/files/') AS URL ,<include refid="cokr.xit.base.file.dao.FileMapper.fileUrl" /> AS 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 ORDER BY FILE_ID
@ -43,7 +51,7 @@ SELECT A.*
<if test="fileIDs == null"> <if test="fileIDs == null">
<include refid="utility.paging-prefix" /> <include refid="utility.paging-prefix" />
SELECT A.* SELECT A.*
, REPLACE(FILE_PATH,#{type},'/files/') AS URL ,<include refid="cokr.xit.base.file.dao.FileMapper.fileUrl" /> AS 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