From 66aff1dfa8fa963c04bebf40e6e8fdec767bf2e1 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Thu, 18 Apr 2024 14:17:41 +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/code-mapper.xml | 230 ++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 src/main/resources/sql/mapper/code-mapper.xml diff --git a/src/main/resources/sql/mapper/code-mapper.xml b/src/main/resources/sql/mapper/code-mapper.xml new file mode 100644 index 0000000..be27d2b --- /dev/null +++ b/src/main/resources/sql/mapper/code-mapper.xml @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SELECT * + FROM TB_CODE_CTGR + WHERE USE_YN = 'Y' + AND CTGR_ID IN (#{categoryID}) + + + + + + + +/* 코드 카테고리 등록(codeMapper.insertCategory) */ +INSERT INTO TB_CODE_CTGR ( + CTGR_ID + , CTGR_NM + , DSCRP + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , USE_YN +) VALUES ( + #{category.id} + , #{category.name} + , #{category.description} + , + , #{currentUser.id} + , + , #{currentUser.id} + , 'Y' +) + +/* 코드 카테고리 수정(codeMapper.updateCategory) */ +UPDATE TB_CODE_CTGR SET + CTGR_NM = #{category.name} + , DSCRP = #{category.description} + , MDFCN_DT = + , MDFR = #{currentUser.id} +WHERE CTGR_ID = #{category.id} + +/* 코드 카테고리 제거(codeMapper.removeCategories) */ +UPDATE TB_CODE_CTGR SET + MDFCN_DT = + , MDFR = #{currentUser.id} + , USE_YN = 'N' +WHERE CTGR_ID IN (#{categoryID}) + + +SELECT * + FROM TB_CODE_GRP + WHERE USE_YN = 'Y' +AND CTGR_ID IN (#{categoryID}) +AND GRP_ID IN (#{groupID}) + + + + + + + +/* 코드그룹 등록(codeMapper.insertGroup) */ +INSERT INTO TB_CODE_GRP ( + GRP_ID + , GRP_NM + , CTGR_ID + , DSCRP + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , USE_YN +) VALUES ( + #{group.id} + , #{group.name} + , #{group.categoryID} + , #{group.description} + , + , #{currentUser.id} + , + , #{currentUser.id} + , 'Y' +) + +/* 코드그룹 수정(codeMapper.updateGroup) */ +UPDATE TB_CODE_GRP SET + GRP_NM = #{group.name} + , CTGR_ID = #{group.categoryID} + , DSCRP = #{group.description} + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE GRP_ID = #{group.id} + +/*코드그룹 제거(codeMapper.removeGroups) */ +UPDATE TB_CODE_GRP SET + USE_YN = 'N' + , MDFCN_DT = + , MDFR = #{currentUser.id} + +CTGR_ID IN (#{categoryID}) +GRP_ID IN (#{groupID}) + + + +SELECT * + FROM TB_CMN_CODE + WHERE USE_YN = 'Y' + AND GRP_ID IN (#{groupID}) + AND CODE IN (#{code}) + + + + + + + +/* 코드 등록(codeMapper.insertCode) */ +INSERT INTO TB_CMN_CODE ( + GRP_ID + , CODE + , CODE_VAL + , DSCRP + , ETC_1 + , ETC_2 + , ETC_3 + , SRT_ORD + , REG_DT + , RGTR + , MDFCN_DT + , MDFR + , USE_YN +) VALUES ( + #{code.groupID} + , #{code.code} + , #{code.value} + , #{code.description} + , #{code.etc1} + , #{code.etc2} + , #{code.etc3} + , #{code.sortOrder} + , + , #{currentUser.id} + , + , #{currentUser.id} + , 'Y' +) + +/* 코드 수정(codeMapper.updateCode) */ +UPDATE TB_CMN_CODE SET + CODE_VAL = #{code.value} + , DSCRP = #{code.description} + , ETC_1 = #{code.etc1} + , ETC_2 = #{code.etc2} + , ETC_3 = #{code.etc3} + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE GRP_ID = #{code.groupID} + AND CODE = #{code.code} + +/* 코드 정렬순서 변경(codeMapper.reorderCodes) */ +UPDATE TB_CMN_CODE SET + SRT_ORD = CASE CODE + WHEN #{code} THEN #{index} + ELSE SRT_ORD + END + , MDFCN_DT = + , MDFR = #{currentUser.id} + WHERE GRP_ID = #{groupID} + AND CODE IN (#{code}) + +/* 코드 제거(codeMapper.removeCodes) */ +UPDATE TB_CMN_CODE SET + MDFCN_DT = + , MDFR = #{currentUser.id} + , USE_YN = 'N' + +AND GRP_ID IN (#{groupID}) +AND CODE IN (#{code}) + + + \ No newline at end of file