|
|
@ -19,7 +19,8 @@
|
|
|
|
<result property="useYN" column="USE_YN"/>
|
|
|
|
<result property="useYN" column="USE_YN"/>
|
|
|
|
</resultMap>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
<sql id="fileDirs">SELECT INF_TYPE
|
|
|
|
<sql id="fileDirs">
|
|
|
|
|
|
|
|
SELECT INF_TYPE
|
|
|
|
, CONCAT('files/', DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR
|
|
|
|
, CONCAT('files/', DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR
|
|
|
|
FROM (
|
|
|
|
FROM (
|
|
|
|
SELECT '010' INF_TYPE, 'interface/attachment/smg' DIR UNION <!-- 국민 신문고 -->
|
|
|
|
SELECT '010' INF_TYPE, 'interface/attachment/smg' DIR UNION <!-- 국민 신문고 -->
|
|
|
@ -29,16 +30,45 @@
|
|
|
|
SELECT '100' INF_TYPE, 'attachment/violation' DIR UNION <!-- 단속 정보 -->
|
|
|
|
SELECT '100' INF_TYPE, 'attachment/violation' DIR UNION <!-- 단속 정보 -->
|
|
|
|
SELECT '110' INF_TYPE, 'attachment/opinion' DIR UNION <!-- 의견 진술 -->
|
|
|
|
SELECT '110' INF_TYPE, 'attachment/opinion' DIR UNION <!-- 의견 진술 -->
|
|
|
|
SELECT '190' INF_TYPE, 'attachment/capture' DIR <!-- 캡쳐용 동영상 -->
|
|
|
|
SELECT '190' INF_TYPE, 'attachment/capture' DIR <!-- 캡쳐용 동영상 -->
|
|
|
|
) FILE_DIRS</sql>
|
|
|
|
) FILE_DIRS
|
|
|
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
<sql id="selectFiles">
|
|
|
|
<sql id="selectFiles">
|
|
|
|
<if test="fileIDs != null">
|
|
|
|
<if test="fileIDs != null">
|
|
|
|
SELECT A.*, FILE_PATH 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
|
|
|
|
|
|
|
|
, A.FILE_PATH 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</if>
|
|
|
|
ORDER BY FILE_ID
|
|
|
|
<if test="fileIDs == null"><include refid="utility.paging-prefix" />
|
|
|
|
</if>
|
|
|
|
SELECT A.*, FILE_PATH URL
|
|
|
|
<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
|
|
|
|
|
|
|
|
, A.FILE_PATH 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>
|
|
|
@ -46,28 +76,46 @@ SELECT A.*, FILE_PATH URL
|
|
|
|
AND USE_YN = 'Y'
|
|
|
|
AND USE_YN = 'Y'
|
|
|
|
</where>
|
|
|
|
</where>
|
|
|
|
<include refid="utility.orderBy" />
|
|
|
|
<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) */
|
|
|
|
<select id="getFileList" parameterType="map" resultType="dataobject">
|
|
|
|
<include refid="selectFiles" /></select>
|
|
|
|
/* 파일 목록 조회(fileMapper.getFileList) */
|
|
|
|
|
|
|
|
<include refid="selectFiles" />
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getFilesOf" parameterType="map" resultMap="fileRow">/* 파일 가져오기(fileMapper.getFilesOf) */
|
|
|
|
<select id="getFilesOf" parameterType="map" resultMap="fileRow">
|
|
|
|
<include refid="selectFiles" /></select>
|
|
|
|
/* 파일 가져오기(fileMapper.getFilesOf) */
|
|
|
|
|
|
|
|
<include refid="selectFiles" />
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getFiles" parameterType="map" resultMap="fileRow">/* 파일 가져오기(fileMapper.getFiles) */
|
|
|
|
<select id="getFiles" parameterType="map" resultMap="fileRow">
|
|
|
|
<include refid="selectFiles" /></select>
|
|
|
|
/* 파일 가져오기(fileMapper.getFiles) */
|
|
|
|
|
|
|
|
<include refid="selectFiles" />
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertFile" parameterType="map">/* 파일 등록(fileMapper.insertFile) */
|
|
|
|
<insert id="insertFile" parameterType="map">
|
|
|
|
|
|
|
|
/* 파일 등록(fileMapper.insertFile) */
|
|
|
|
<selectKey keyProperty="file.id,file.path" keyColumn="NEW_ID,PATH" resultType="map" order="BEFORE">
|
|
|
|
<selectKey keyProperty="file.id,file.path" keyColumn="NEW_ID,PATH" resultType="map" order="BEFORE">
|
|
|
|
SELECT NEW_ID, CONCAT(DIR, NEW_ID, '.', #{file.extension}) PATH
|
|
|
|
SELECT NEW_ID
|
|
|
|
|
|
|
|
, CONCAT(DIR, NEW_ID, '.', #{file.extension}) PATH
|
|
|
|
FROM (
|
|
|
|
FROM (
|
|
|
|
SELECT NVL(MAX(FILE_ID) + 1, CONCAT(THIS_DAY, '00001')) NEW_ID
|
|
|
|
SELECT NVL(MAX(FILE_ID) + 1, CONCAT(THIS_DAY, '00001')) NEW_ID
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
FROM (<include refid="utility.selectThisDay" />) B LEFT OUTER JOIN
|
|
|
|
FROM (<include refid="utility.selectThisDay" />) B LEFT OUTER JOIN
|
|
|
|
TB_FILE A ON FILE_ID LIKE CONCAT(THIS_DAY, '%')
|
|
|
|
TB_FILE A ON FILE_ID LIKE CONCAT(THIS_DAY, '%')
|
|
|
|
) T1, (
|
|
|
|
) T1, (
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
FROM (<include refid="utility.selectThisDay" />) B
|
|
|
|
|
|
|
|
LEFT OUTER JOIN TB_FILE A ON FILE_ID LIKE CONCAT(THIS_DAY, '%')
|
|
|
|
|
|
|
|
) T1
|
|
|
|
|
|
|
|
, (
|
|
|
|
|
|
|
|
>>>>>>> branch 'main' of http://xit.xit-git.com:3000/xit-app/fims.git
|
|
|
|
<include refid="fileDirs" />
|
|
|
|
<include refid="fileDirs" />
|
|
|
|
WHERE INF_TYPE = #{file.infoType}
|
|
|
|
WHERE INF_TYPE = #{file.infoType}
|
|
|
|
) T2</selectKey>
|
|
|
|
) T2
|
|
|
|
|
|
|
|
</selectKey>
|
|
|
|
INSERT INTO TB_FILE (
|
|
|
|
INSERT INTO TB_FILE (
|
|
|
|
FILE_ID
|
|
|
|
FILE_ID
|
|
|
|
, INF_TYPE
|
|
|
|
, INF_TYPE
|
|
|
@ -99,31 +147,39 @@ INSERT INTO TB_FILE (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
</insert>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="reorder" parameterType="map">/* 파일 순서 변경(fileMapper.reorder) */
|
|
|
|
<update id="reorder" parameterType="map">
|
|
|
|
UPDATE TB_FILE SET
|
|
|
|
/* 파일 순서 변경(fileMapper.reorder) */
|
|
|
|
SRT_ORD = CASE FILE_ID
|
|
|
|
UPDATE TB_FILE
|
|
|
|
<foreach collection="fileIDs" item="fileID" index="index" separator=" ">WHEN #{fileID} THEN #{index}
|
|
|
|
SET SRT_ORD = CASE FILE_ID
|
|
|
|
|
|
|
|
<foreach collection="fileIDs" item="fileID" index="index" separator=" ">
|
|
|
|
|
|
|
|
WHEN #{fileID} THEN #{index}
|
|
|
|
</foreach>
|
|
|
|
</foreach>
|
|
|
|
ELSE SRT_ORD END
|
|
|
|
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
|
|
|
|
UPDATE TB_FILE SET
|
|
|
|
DNLD_CNT = DNLD_CNT + 1
|
|
|
|
DNLD_CNT = DNLD_CNT + 1
|
|
|
|
WHERE USE_YN = 'Y'
|
|
|
|
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 id="removeFiles" parameterType="map">
|
|
|
|
UPDATE TB_FILE SET
|
|
|
|
/* 파일 제거(fileMapper.removeFiles) */
|
|
|
|
USE_YN = 'N'
|
|
|
|
UPDATE TB_FILE
|
|
|
|
|
|
|
|
SET USE_YN = 'N'
|
|
|
|
WHERE USE_YN = 'Y'
|
|
|
|
WHERE USE_YN = 'Y'
|
|
|
|
<if test="fileIDs != null"> AND FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
|
|
|
<if test="fileIDs != null"> AND FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
|
|
|
<if test="infoKeys != null">
|
|
|
|
<if test="infoKeys != null">
|
|
|
|
AND INF_TYPE = #{infoType}
|
|
|
|
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 id="deleteFiles" parameterType="map">/* 파일 삭제(fileMapper.deleteFiles) */
|
|
|
|
DELETE FROM TB_FILE
|
|
|
|
DELETE
|
|
|
|
|
|
|
|
FROM TB_FILE
|
|
|
|
<if test="fileIDs != null">WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
|
|
|
<if test="fileIDs != null">WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
|
|
|
|
</delete>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|