fileDir, fileUrl 분리

main
mjkhan21 4 months ago
parent 96766399f2
commit 97d602a1bd

@ -19,9 +19,12 @@
<result property="useYN" column="USE_YN"/> <result property="useYN" column="USE_YN"/>
</resultMap> </resultMap>
<sql id="fileDir">CONCAT('files/', DIR, DATE_FORMAT(CURRENT_DATE, '%Y/%m/%d/'))</sql>
<sql id="fileUrl">FILE_PATH</sql>
<sql id="fileDirs"> <sql id="fileDirs">
SELECT INF_TYPE SELECT INF_TYPE
, CONCAT('files/', DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR ,<include refid="cokr.xit.base.file.dao.FileMapper.fileDir" /> DIR
FROM ( FROM (
SELECT '010' INF_TYPE, 'interface/attachment/smg' DIR UNION <!-- 국민 신문고 --> SELECT '010' INF_TYPE, 'interface/attachment/smg' DIR UNION <!-- 국민 신문고 -->
SELECT '020' INF_TYPE, 'interface/attachment/saeol' DIR UNION <!-- 세올 --> SELECT '020' INF_TYPE, 'interface/attachment/saeol' DIR UNION <!-- 세올 -->
@ -48,7 +51,7 @@ SELECT A.FILE_ID
, A.USE_YN , A.USE_YN
, A.REG_DT , A.REG_DT
, A.RGTR , A.RGTR
, A.FILE_PATH 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
@ -68,7 +71,7 @@ SELECT A.FILE_ID
, A.USE_YN , A.USE_YN
, A.REG_DT , A.REG_DT
, A.RGTR , A.RGTR
, A.FILE_PATH 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