mjkhan21 5 months ago
commit 3de6708f69

@ -19,7 +19,8 @@
<result property="useYN" column="USE_YN"/>
</resultMap>
<sql id="fileDirs">SELECT INF_TYPE
<sql id="fileDirs">
SELECT INF_TYPE
, CONCAT('files/', DIR, DATE_FORMAT(CURRENT_DATE, '/%Y/%m/%d/')) DIR
FROM (
SELECT '010' INF_TYPE, 'interface/attachment/smg' DIR UNION <!-- 국민 신문고 -->
@ -29,16 +30,45 @@
SELECT '100' INF_TYPE, 'attachment/violation' DIR UNION <!-- 단속 정보 -->
SELECT '110' INF_TYPE, 'attachment/opinion' DIR UNION <!-- 의견 진술 -->
SELECT '190' INF_TYPE, 'attachment/capture' DIR <!-- 캡쳐용 동영상 -->
) FILE_DIRS</sql>
) FILE_DIRS
</sql>
<sql id="selectFiles">
<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
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.*, FILE_PATH 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
, A.FILE_PATH AS URL
FROM TB_FILE A
<where>
<if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if>
@ -46,28 +76,46 @@ SELECT A.*, FILE_PATH URL
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) */
<insert id="insertFile" parameterType="map">
/* 파일 등록(fileMapper.insertFile) */
<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 (
SELECT NVL(MAX(FILE_ID) + 1, CONCAT(THIS_DAY, '00001')) NEW_ID
<<<<<<< HEAD
FROM (<include refid="utility.selectThisDay" />) B LEFT OUTER JOIN
TB_FILE A ON FILE_ID LIKE CONCAT(THIS_DAY, '%')
) 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" />
WHERE INF_TYPE = #{file.infoType}
) T2</selectKey>
) T2
</selectKey>
INSERT INTO TB_FILE (
FILE_ID
, INF_TYPE
@ -99,31 +147,39 @@ 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}
<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
FROM TB_FILE
<if test="fileIDs != null">WHERE FILE_ID IN (<foreach collection="fileIDs" item="fileID" separator=",">#{fileID}</foreach>)</if>
</delete>

@ -39,7 +39,8 @@
<result property="status" column="STTS"/>
</resultMap>
<sql id="selectUsers"><include refid="utility.paging-prefix" />
<sql id="selectUsers">
<include refid="utility.paging-prefix" />
SELECT USER_ID
, USER_ACNT
, USER_NM
@ -83,12 +84,15 @@ SELECT USER_ID
, STTS
, (SELECT GET_CODE_NM('CMN004', STTS) FROM DUAL) AS STTS_NM
FROM TB_USER A
<where><if test="by != null and term != null">AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<where>
<if test="by != null and term != null">AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="userIDs != null">USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if>
<if test="status == null and userIDs == null">AND STTS != 'D'</if>
<if test="status != null">AND STTS = #{status}</if></where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></sql>
<if test="status != null">AND STTS = #{status}</if>
</where>
<include refid="utility.orderBy" />
<include refid="utility.paging-suffix" />
</sql>
<select id="getUserList" parameterType="map" resultType="dataobject">/* 사용자 목록 조회(userMapper.getUserList) */
<include refid="selectUsers"/></select>
@ -179,7 +183,8 @@ INSERT INTO TB_USER (
, #{status}
)</insert>
<update id="updateUser" parameterType="cokr.xit.base.user.ManagedUser">/* 사용자 정보 수정(userMapper.updateUser) */
<update id="updateUser" parameterType="cokr.xit.base.user.ManagedUser">
/* 사용자 정보 수정(userMapper.updateUser) */
UPDATE TB_USER SET
USER_NM = #{name}
, PASSWD_HINT = #{passwordHint}
@ -207,7 +212,8 @@ UPDATE TB_USER SET
, MDFR = #{modifiedBy}
WHERE USER_ID = #{id}</update>
<update id="changePassword" parameterType="map">/* 비밀번호 변경(userMapper.changePassword) */
<update id="changePassword" parameterType="map">
/* 비밀번호 변경(userMapper.changePassword) */
UPDATE TB_USER SET
PASSWD = CASE USER_ID<foreach collection="userPasswords" item="userPassword" separator=" ">
WHEN #{userPassword.userID} THEN #{userPassword.password}</foreach>
@ -217,7 +223,8 @@ UPDATE TB_USER SET
WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)
</update>
<update id="lockUsers" parameterType="map">/* 사용자 잠김 해제(userMapper.lockUsers) */
<update id="lockUsers" parameterType="map">
/* 사용자 잠김 해제(userMapper.lockUsers) */
UPDATE TB_USER SET
<if test='lock == true'> LOCK_YN = 'Y'
, LOCK_CNT = LOCK_CNT + 1
@ -230,7 +237,8 @@ UPDATE TB_USER SET
WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)
</update>
<update id="setStatus" parameterType="map">/* 사용자 상태 변경(userMapper.setStatus) */
<update id="setStatus" parameterType="map">
/* 사용자 상태 변경(userMapper.setStatus) */
UPDATE TB_USER SET
STTS = #{status}
<if test='"D" == status'>, USE_YN = 'N'</if>

Loading…
Cancel
Save