fileDir, fileUrl 분리

dev
mjkhan21 4 months ago
parent 4380fc9a9b
commit 41e39107b4

@ -41,8 +41,7 @@
<if test="sggID != null"> AND SGG_CD = #{sggID}</if> <if test="sggID != null"> AND SGG_CD = #{sggID}</if>
<if test="instCode != null"> AND INST_CD = #{instCode}</if> <if test="instCode != null"> AND INST_CD = #{instCode}</if>
<if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if> <if test="deptIDs != null"> AND DEPT_CD IN (<foreach collection="deptIDs" item="deptID" separator=",">#{deptID}</foreach>)</if>
<if test="!includeAll"> AND USE_YN = 'Y'</if> <if test="!includeAll"> AND USE_YN = 'Y'</if></where>
</where>
<include refid="utility.orderBy" /> <include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select> <include refid="utility.paging-suffix" /></select>

@ -19,9 +19,16 @@
<result property="useYN" column="USE_YN"/> <result property="useYN" column="USE_YN"/>
</resultMap> </resultMap>
<sql id="fileDir">CONCAT(#{addsFileRootPath}, DIR, DATE_FORMAT(CURRENT_DATE, '%Y/%m/%d/'))</sql>
<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"> <sql id="fileDirs">
SELECT INF_TYPE SELECT INF_TYPE
, CONCAT(#{addsFileRootPath}, DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR ,<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
@ -47,11 +54,7 @@ SELECT A.FILE_ID
, A.USE_YN , A.USE_YN
, A.REG_DT , A.REG_DT
, A.RGTR , A.RGTR
, (CASE ,<include refid="cokr.xit.base.file.dao.FileMapper.fileUrl" /> AS URL
WHEN REPLACE(FILE_PATH,#{type},'/files/') LIKE '_:%'
THEN SUBSTR(REPLACE(FILE_PATH,#{type},'/files/'),3)
ELSE REPLACE(FILE_PATH,#{type},'/files/')
END) 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
@ -71,11 +74,7 @@ SELECT A.FILE_ID
, A.USE_YN , A.USE_YN
, A.REG_DT , A.REG_DT
, A.RGTR , A.RGTR
, (CASE ,<include refid="cokr.xit.base.file.dao.FileMapper.fileUrl" /> AS URL
WHEN REPLACE(FILE_PATH,#{type},'/files/') LIKE '_:%'
THEN SUBSTR(REPLACE(FILE_PATH,#{type},'/files/'),3)
ELSE REPLACE(FILE_PATH,#{type},'/files/')
END) 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