|
|
|
@ -19,7 +19,8 @@
|
|
|
|
|
<result property="useYN" column="USE_YN"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="fileDirs">SELECT INF_TYPE
|
|
|
|
|
<sql id="fileDirs">
|
|
|
|
|
SELECT INF_TYPE
|
|
|
|
|
, CONCAT(#{addsFileRootPath}, DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT '00' INF_TYPE, 'attachment' DIR FROM DUAL UNION
|
|
|
|
@ -33,14 +34,48 @@
|
|
|
|
|
|
|
|
|
|
<sql id="selectFiles">
|
|
|
|
|
<if test="fileIDs != null">
|
|
|
|
|
SELECT A.*
|
|
|
|
|
, REPLACE(FILE_PATH,#{type},'/files/') AS URL
|
|
|
|
|
SELECT A.FILE_ID
|
|
|
|
|
, A.INF_TYPE
|
|
|
|
|
, A.INF_KEY
|
|
|
|
|
, A.SUB_TYPE
|
|
|
|
|
, A.FILE_NM
|
|
|
|
|
, A.FILE_PATH
|
|
|
|
|
, A.MIME_TYPE
|
|
|
|
|
, A.FILE_SIZE
|
|
|
|
|
, A.DNLD_CNT
|
|
|
|
|
, A.SRT_ORD
|
|
|
|
|
, A.USE_YN
|
|
|
|
|
, A.REG_DT
|
|
|
|
|
, A.RGTR
|
|
|
|
|
, (CASE
|
|
|
|
|
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
|
|
|
|
|
WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)
|
|
|
|
|
ORDER BY FILE_ID</if>
|
|
|
|
|
<if test="fileIDs == null"><include refid="utility.paging-prefix" />
|
|
|
|
|
SELECT A.*
|
|
|
|
|
, REPLACE(FILE_PATH,#{type},'/files/') AS URL
|
|
|
|
|
ORDER BY FILE_ID
|
|
|
|
|
</if>
|
|
|
|
|
<if test="fileIDs == null">
|
|
|
|
|
<include refid="utility.paging-prefix" />
|
|
|
|
|
SELECT A.FILE_ID
|
|
|
|
|
, A.INF_TYPE
|
|
|
|
|
, A.INF_KEY
|
|
|
|
|
, A.SUB_TYPE
|
|
|
|
|
, A.FILE_NM
|
|
|
|
|
, A.FILE_PATH
|
|
|
|
|
, A.MIME_TYPE
|
|
|
|
|
, A.FILE_SIZE
|
|
|
|
|
, A.DNLD_CNT
|
|
|
|
|
, A.SRT_ORD
|
|
|
|
|
, A.USE_YN
|
|
|
|
|
, A.REG_DT
|
|
|
|
|
, A.RGTR
|
|
|
|
|
, (CASE
|
|
|
|
|
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
|
|
|
|
|
<where>
|
|
|
|
|
<if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if>
|
|
|
|
@ -51,16 +86,23 @@ AND ${by} = #{term}
|
|
|
|
|
AND USE_YN = 'Y'
|
|
|
|
|
</where>
|
|
|
|
|
<include refid="utility.orderBy" />
|
|
|
|
|
<include refid="utility.paging-suffix" /></if></sql>
|
|
|
|
|
<include refid="utility.paging-suffix" /></if>
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="getFileList" parameterType="map" resultType="dataobject">/* 파일 목록 조회(fileMapper.getFileList) */
|
|
|
|
|
<include refid="selectFiles" /></select>
|
|
|
|
|
<select id="getFileList" parameterType="map" resultType="dataobject">
|
|
|
|
|
/* 파일 목록 조회(fileMapper.getFileList) */
|
|
|
|
|
<include refid="selectFiles" />
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getFilesOf" parameterType="map" resultMap="fileRow">/* 파일 가져오기(fileMapper.getFilesOf) */
|
|
|
|
|
<include refid="selectFiles" /></select>
|
|
|
|
|
<select id="getFilesOf" parameterType="map" resultMap="fileRow">
|
|
|
|
|
/* 파일 가져오기(fileMapper.getFilesOf) */
|
|
|
|
|
<include refid="selectFiles" />
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getFiles" parameterType="map" resultMap="fileRow">/* 파일 가져오기(fileMapper.getFiles) */
|
|
|
|
|
<include refid="selectFiles" /></select>
|
|
|
|
|
<select id="getFiles" parameterType="map" resultMap="fileRow">
|
|
|
|
|
/* 파일 가져오기(fileMapper.getFiles) */
|
|
|
|
|
<include refid="selectFiles" />
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertFile" parameterType="map">/* 파일 등록(fileMapper.insertFile) */
|
|
|
|
|
<selectKey keyProperty="file.id,file.path" keyColumn="NEW_ID,PATH" resultType="map" order="BEFORE">
|
|
|
|
@ -104,31 +146,40 @@ INSERT INTO TB_FILE (
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="reorder" parameterType="map">/* 파일 순서 변경(fileMapper.reorder) */
|
|
|
|
|
UPDATE TB_FILE SET
|
|
|
|
|
SRT_ORD = CASE FILE_ID
|
|
|
|
|
<foreach collection="fileIDs" item="fileID" index="index" separator=" ">WHEN #{fileID} THEN #{index}
|
|
|
|
|
</foreach>
|
|
|
|
|
<update id="reorder" parameterType="map">
|
|
|
|
|
/* 파일 순서 변경(fileMapper.reorder) */
|
|
|
|
|
UPDATE TB_FILE
|
|
|
|
|
SET SRT_ORD = CASE FILE_ID
|
|
|
|
|
<foreach collection="fileIDs" item="fileID" index="index" separator=" ">
|
|
|
|
|
WHEN #{fileID} THEN #{index}
|
|
|
|
|
</foreach>
|
|
|
|
|
ELSE SRT_ORD END
|
|
|
|
|
WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</update>
|
|
|
|
|
WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateDownloadCount" parameterType="map">/* 다운로드 횟수 증가(fileMapper.updateDownloadCount) */
|
|
|
|
|
<update id="updateDownloadCount" parameterType="map">
|
|
|
|
|
/* 다운로드 횟수 증가(fileMapper.updateDownloadCount) */
|
|
|
|
|
UPDATE TB_FILE SET
|
|
|
|
|
DNLD_CNT = DNLD_CNT + 1
|
|
|
|
|
WHERE USE_YN = 'Y'
|
|
|
|
|
AND FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</update>
|
|
|
|
|
AND FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="removeFiles" parameterType="map">/* 파일 제거(fileMapper.removeFiles) */
|
|
|
|
|
UPDATE TB_FILE SET
|
|
|
|
|
USE_YN = 'N'
|
|
|
|
|
<update id="removeFiles" parameterType="map">
|
|
|
|
|
/* 파일 제거(fileMapper.removeFiles) */
|
|
|
|
|
UPDATE TB_FILE
|
|
|
|
|
SET USE_YN = 'N'
|
|
|
|
|
WHERE USE_YN = 'Y'
|
|
|
|
|
<if test="fileIDs != null"> AND FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
|
|
|
|
<if test="infoKeys != null">
|
|
|
|
|
AND INF_TYPE = #{infoType}
|
|
|
|
|
AND INF_KEY IN (<foreach collection="infoKeys" item="infoKey" separator=",">#{infoKey}</foreach>)</if></update>
|
|
|
|
|
AND INF_KEY IN (<foreach collection="infoKeys" item="infoKey" separator=",">#{infoKey}</foreach>)</if>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteFiles" parameterType="map">/* 파일 삭제(fileMapper.deleteFiles) */
|
|
|
|
|
DELETE FROM TB_FILE
|
|
|
|
|
<delete id="deleteFiles" parameterType="map">
|
|
|
|
|
/* 파일 삭제(fileMapper.deleteFiles) */
|
|
|
|
|
DELETE
|
|
|
|
|
FROM TB_FILE
|
|
|
|
|
<if test="fileIDs != null">WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|