From 43e04de2951b14946e458a69faa54e21c8fc033f Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Thu, 18 Apr 2024 14:16:35 +0900 Subject: [PATCH] =?UTF-8?q?sql=20mapper=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/sql/mapper/user-mapper.xml | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 src/main/resources/sql/mapper/user-mapper.xml diff --git a/src/main/resources/sql/mapper/user-mapper.xml b/src/main/resources/sql/mapper/user-mapper.xml new file mode 100644 index 0000000..5b7540b --- /dev/null +++ b/src/main/resources/sql/mapper/user-mapper.xml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SELECT USER_ID + , USER_ACNT + , USER_NM + , PASSWD_HINT + , PASSWD_NSR + , EMP_NO + , RSDNT_NO + , GENDER + , BRDT + , AREA_NO + , ZIP + , ADDR + , DADDR + , TELNO + , MBL_TELNO + , FXNO + , EML_ADRS + , POS_NM + , GRP_ID + , ORG_ID + , (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = A.ORG_ID) AS SGG_NM + , DEPT_CD + , (CASE + WHEN A.DEPT_CD = 'default' + THEN '기본 부서' + ELSE (SELECT DEPT_NM FROM TB_DEPT WHERE DEPT_CD = A.DEPT_CD) + END + ) AS DEPT_NM + , NSTT_CD + , (CASE + WHEN A.NSTT_CD = 'default' + THEN '기본 기관' + ELSE (SELECT INST_NM FROM TB_SGG WHERE INST_CD = A.NSTT_CD AND SGG_CD = A.ORG_ID) + END + ) AS NSTT_NM + , CRTFC_DN + , LOCK_YN + , LOCK_CNT + , LOCK_DT + , REG_DT + , STTS + , (SELECT GET_CODE_NM('CMN004', STTS) FROM DUAL) AS STTS_NM + FROM TB_USER A +AND ${by} LIKE CONCAT('%', #{term}, '%') + USER_ID IN (#{userID}) + AND STTS != 'D' + AND STTS = #{status} + + + + + + + + + + +SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER +/* 사용자 정보 등록(userMapper.insertUser) */ +INSERT INTO TB_USER ( + USER_ID + , USER_ACNT + , USER_NM + , PASSWD + , PASSWD_HINT + , PASSWD_NSR + , EMP_NO + , RSDNT_NO + , GENDER + , BRDT + , AREA_NO + , ZIP + , ADDR + , DADDR + , TELNO + , MBL_TELNO + , FXNO + , EML_ADRS + , POS_NM + , GRP_ID + , ORG_ID + , NSTT_CD + , DEPT_CD + , CRTFC_DN + , LOCK_YN + , LOCK_CNT + , LOCK_DT + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , USE_YN + , STTS +) VALUES ( + #{id} + , #{account} + , #{name} + , #{password} + , #{passwordHint} + , #{passwordHintAnswer} + , #{empNo} + , #{residentRegNo} + , #{gender} + , #{birthday} + , #{areaNo} + , #{zipCode} + , #{address} + , #{addressDetail} + , #{phoneNo} + , #{mobilePhoneNo} + , #{faxNo} + , #{emailAddress} + , #{positionName} + , #{groupID} + , #{orgID} + , #{institute} + , #{deptCode} + , #{certificateDn} + , 'N' + , 0 + , NULL + , + , #{createdBy} + , + , #{createdBy} + , 'Y' + , #{status} +) + +/* 사용자 정보 수정(userMapper.updateUser) */ +UPDATE TB_USER SET + USER_NM = #{name} + , PASSWD_HINT = #{passwordHint} + , PASSWD_NSR = #{passwordHintAnswer} + , EMP_NO = #{empNo} + , RSDNT_NO = #{residentRegNo} + , GENDER = #{gender} + , BRDT = #{birthday} + , AREA_NO = #{areaNo} + , ZIP = #{zipCode} + , ADDR = #{address} + , DADDR = #{addressDetail} + , TELNO = #{phoneNo} + , MBL_TELNO = #{mobilePhoneNo} + , FXNO = #{faxNo} + , EML_ADRS = #{emailAddress} + , POS_NM = #{positionName} + , GRP_ID = #{groupID} + , ORG_ID = #{orgID} + , NSTT_CD = #{institute} + , DEPT_CD = #{deptCode} + , CRTFC_DN = #{certificateDn} + , MDFCN_DT = + , MDFR = #{modifiedBy} + WHERE USER_ID = #{id} + +/* 비밀번호 변경(userMapper.changePassword) */ +UPDATE TB_USER SET + PASSWD = CASE USER_ID + WHEN #{userPassword.userID} THEN #{userPassword.password} + ELSE PASSWD END + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE USER_ID IN (#{userID}) + + +/* 사용자 잠김 해제(userMapper.lockUsers) */ +UPDATE TB_USER SET + LOCK_YN = 'Y' + , LOCK_CNT = LOCK_CNT + 1 + , LOCK_DT = + LOCK_YN = 'N' + , LOCK_CNT = 0 + , LOCK_DT = NULL + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE USER_ID IN (#{userID}) + + +/* 사용자 상태 변경(userMapper.setStatus) */ +UPDATE TB_USER SET + STTS = #{status} + , USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE USER_ID IN (#{userID}) + AND STTS != #{status} + + + \ No newline at end of file