diff --git a/src/main/resources/sql/mapper/base/file-mapper.xml b/src/main/resources/sql/mapper/base/file-mapper.xml index de3cbad8..f44e5572 100644 --- a/src/main/resources/sql/mapper/base/file-mapper.xml +++ b/src/main/resources/sql/mapper/base/file-mapper.xml @@ -19,7 +19,8 @@ -SELECT INF_TYPE + +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 + ) FILE_DIRS + -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 (#{fileID}) - ORDER BY FILE_ID - -SELECT A.*, FILE_PATH URL + ORDER BY FILE_ID + + + +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 AND A.INF_TYPE = #{infoType} @@ -46,28 +76,46 @@ SELECT A.*, FILE_PATH URL AND USE_YN = 'Y' - + + + - + - + - + -/* 파일 등록(fileMapper.insertFile) */ + +/* 파일 등록(fileMapper.insertFile) */ -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 () B LEFT OUTER JOIN TB_FILE A ON FILE_ID LIKE CONCAT(THIS_DAY, '%') ) T1, ( +======= + FROM () 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 WHERE INF_TYPE = #{file.infoType} - ) T2 + ) T2 + INSERT INTO TB_FILE ( FILE_ID , INF_TYPE @@ -99,31 +147,39 @@ INSERT INTO TB_FILE ( ) -/* 파일 순서 변경(fileMapper.reorder) */ -UPDATE TB_FILE SET - SRT_ORD = CASE FILE_ID - WHEN #{fileID} THEN #{index} - + +/* 파일 순서 변경(fileMapper.reorder) */ +UPDATE TB_FILE + SET SRT_ORD = CASE FILE_ID + + WHEN #{fileID} THEN #{index} + ELSE SRT_ORD END -WHERE FILE_ID IN (#{fileID}) + WHERE FILE_ID IN (#{fileID}) + -/* 다운로드 횟수 증가(fileMapper.updateDownloadCount) */ + +/* 다운로드 횟수 증가(fileMapper.updateDownloadCount) */ UPDATE TB_FILE SET DNLD_CNT = DNLD_CNT + 1 WHERE USE_YN = 'Y' - AND FILE_ID IN (#{fileID}) + AND FILE_ID IN (#{fileID}) + -/* 파일 제거(fileMapper.removeFiles) */ -UPDATE TB_FILE SET - USE_YN = 'N' + +/* 파일 제거(fileMapper.removeFiles) */ +UPDATE TB_FILE + SET USE_YN = 'N' WHERE USE_YN = 'Y' AND FILE_ID IN (#{fileID}) AND INF_TYPE = #{infoType} - AND INF_KEY IN (#{infoKey}) + AND INF_KEY IN (#{infoKey}) + /* 파일 삭제(fileMapper.deleteFiles) */ -DELETE FROM TB_FILE +DELETE + FROM TB_FILE WHERE FILE_ID IN (#{fileID}) diff --git a/src/main/resources/sql/mapper/base/user-mapper.xml b/src/main/resources/sql/mapper/base/user-mapper.xml index a0121f28..aafeedb9 100644 --- a/src/main/resources/sql/mapper/base/user-mapper.xml +++ b/src/main/resources/sql/mapper/base/user-mapper.xml @@ -39,7 +39,8 @@ - + + 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 -AND ${by} LIKE CONCAT('%', #{term}, '%') + + AND ${by} LIKE CONCAT('%', #{term}, '%') USER_ID IN (#{userID}) AND STTS != 'D' - AND STTS = #{status} - - + AND STTS = #{status} + + + + @@ -179,7 +183,8 @@ INSERT INTO TB_USER ( , #{status} ) -/* 사용자 정보 수정(userMapper.updateUser) */ + +/* 사용자 정보 수정(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} -/* 비밀번호 변경(userMapper.changePassword) */ + +/* 비밀번호 변경(userMapper.changePassword) */ UPDATE TB_USER SET PASSWD = CASE USER_ID WHEN #{userPassword.userID} THEN #{userPassword.password} @@ -217,7 +223,8 @@ UPDATE TB_USER SET WHERE USER_ID IN (#{userID}) -/* 사용자 잠김 해제(userMapper.lockUsers) */ + +/* 사용자 잠김 해제(userMapper.lockUsers) */ UPDATE TB_USER SET LOCK_YN = 'Y' , LOCK_CNT = LOCK_CNT + 1 @@ -230,7 +237,8 @@ UPDATE TB_USER SET WHERE USER_ID IN (#{userID}) -/* 사용자 상태 변경(userMapper.setStatus) */ + +/* 사용자 상태 변경(userMapper.setStatus) */ UPDATE TB_USER SET STTS = #{status} , USE_YN = 'N'