소스 정리

main
이범준 5 months ago
parent 04e2d47aef
commit 8a810e99b9

@ -9,22 +9,29 @@
<result property="createdAt" column="REG_DT"/> <result property="createdAt" column="REG_DT"/>
</resultMap> </resultMap>
<sql id="selectGroups"><include refid="utility.paging-prefix" /> <sql id="selectGroups">
<include refid="utility.paging-prefix" />
SELECT A.* SELECT A.*
FROM TB_ACTION_GRP A FROM TB_ACTION_GRP A
<where> <where>
<if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if> <if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
<if test="by != null and term != null">AND ${by} LIKE CONCAT('%', #{term}, '%')</if> <if test="by != null and term != null">AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
</where> </where>
<include refid="utility.paging-suffix" /></sql> <include refid="utility.paging-suffix" />
</sql>
<select id="getGroupList" parameterType="map" resultType="dataobject">/* 기능그룹 목록 조회(actionGroupMapper.getGroupList) */ <select id="getGroupList" parameterType="map" resultType="dataobject">
<include refid="selectGroups" /></select> /* 기능그룹 목록 조회(actionGroupMapper.getGroupList) */
<include refid="selectGroups" />
</select>
<select id="getGroups" parameterType="map" resultMap="groupRow">/* 기능그룹 가져오기(actionGroupMapper.getGroups) */ <select id="getGroups" parameterType="map" resultMap="groupRow">
<include refid="selectGroups" /></select> /* 기능그룹 가져오기(actionGroupMapper.getGroups) */
<include refid="selectGroups" />
</select>
<insert id="insertGroup" parameterType="cokr.xit.base.security.access.ActionGroup">/* 기능그룹 등록(actionGroupMapper.insertGroup) */ <insert id="insertGroup" parameterType="cokr.xit.base.security.access.ActionGroup">
/* 기능그룹 등록(actionGroupMapper.insertGroup) */
INSERT INTO TB_ACTION_GRP ( INSERT INTO TB_ACTION_GRP (
GRP_ID GRP_ID
, GRP_NM , GRP_NM
@ -35,27 +42,35 @@ INSERT INTO TB_ACTION_GRP (
, #{name} , #{name}
, #{description} , #{description}
,<include refid="utility.now" /> ,<include refid="utility.now" />
)</insert> )
</insert>
<update id="updateGroup" parameterType="cokr.xit.base.security.access.ActionGroup">/* 기능그룹 수정(actionGroupMapper.updateGroup) */ <update id="updateGroup" parameterType="cokr.xit.base.security.access.ActionGroup">
/* 기능그룹 수정(actionGroupMapper.updateGroup) */
UPDATE TB_ACTION_GRP SET UPDATE TB_ACTION_GRP SET
GRP_NM = #{name} GRP_NM = #{name}
, DSCRP = #{description} , DSCRP = #{description}
WHERE GRP_ID = #{id}</update> WHERE GRP_ID = #{id}
</update>
<delete id="removeGroups" parameterType="map">/* 기능그룹 삭제(actionGroupMapper.removeGroups) */ <delete id="removeGroups" parameterType="map">
/* 기능그룹 삭제(actionGroupMapper.removeGroups) */
DELETE FROM TB_ACTION_GRP DELETE FROM TB_ACTION_GRP
WHERE GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</delete> WHERE GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)
</delete>
<select id="getActionList" parameterType="map" resultType="dataobject">/* 그룹별 기능 가져오기(actionGroupMapper.getActionList) */ <select id="getActionList" parameterType="map" resultType="dataobject">
/* 그룹별 기능 가져오기(actionGroupMapper.getActionList) */
<include refid="utility.paging-prefix" /> <include refid="utility.paging-prefix" />
SELECT * SELECT *
FROM TB_GRP_ACTION FROM TB_GRP_ACTION
<if test="groupIDs != null">WHERE GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if> <if test="groupIDs != null">WHERE GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>
<include refid="utility.orderBy" /> <include refid="utility.orderBy" />
<include refid="utility.paging-suffix" /></select> <include refid="utility.paging-suffix" />
</select>
<insert id="addActions" parameterType="map">/* 그룹별 기능 추가(actionGroupMapper.addActions) */ <insert id="addActions" parameterType="map">
/* 그룹별 기능 추가(actionGroupMapper.addActions) */
INSERT INTO TB_GRP_ACTION (GRP_ID, ACTION, REG_DT, RGTR) INSERT INTO TB_GRP_ACTION (GRP_ID, ACTION, REG_DT, RGTR)
SELECT GRP_ID, ACTION,<include refid="utility.now" />, #{currentUser.id} SELECT GRP_ID, ACTION,<include refid="utility.now" />, #{currentUser.id}
FROM (<foreach collection="actions" item="action" separator="UNION"> FROM (<foreach collection="actions" item="action" separator="UNION">
@ -66,9 +81,11 @@ SELECT GRP_ID, ACTION,<include refid="utility.now" />, #{currentUser.id}
FROM TB_GRP_ACTION B FROM TB_GRP_ACTION B
WHERE B.GRP_ID = A.GRP_ID WHERE B.GRP_ID = A.GRP_ID
AND B.ACTION = A.ACTION AND B.ACTION = A.ACTION
)</insert> )
</insert>
<delete id="removeActions" parameterType="map">/* 그룹별 기능 삭제(actionGroupMapper.removeActions) */ <delete id="removeActions" parameterType="map">
/* 그룹별 기능 삭제(actionGroupMapper.removeActions) */
DELETE FROM TB_GRP_ACTION DELETE FROM TB_GRP_ACTION
<where> <where>
<if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if> <if test="groupIDs != null">AND GRP_ID IN (<foreach collection="groupIDs" item="groupID" separator=",">#{groupID}</foreach>)</if>

@ -12,7 +12,8 @@
<result property="createdAt" column="REG_DT"/> <result property="createdAt" column="REG_DT"/>
</resultMap> </resultMap>
<sql id="selectAuthorities"><include refid="utility.paging-prefix" /> <sql id="selectAuthorities">
<include refid="utility.paging-prefix" />
SELECT * FROM ( SELECT * FROM (
SELECT 0 AUTH_TYPE, 'ROLE_ADMIN' AUTH_ID, '시스템 관리자' AUTH_NM, '시스템 관리자' DSCRP, 'all' INF_SCP, 'all' USER_INF_SCP,<include refid="utility.now"/>REG_DT UNION SELECT 0 AUTH_TYPE, 'ROLE_ADMIN' AUTH_ID, '시스템 관리자' AUTH_NM, '시스템 관리자' DSCRP, 'all' INF_SCP, 'all' USER_INF_SCP,<include refid="utility.now"/>REG_DT UNION
SELECT 1 AUTH_TYPE, 'ROLE_ANONYMOUS' AUTH_ID, '익명 사용자' AUTH_NM, '모든 사용자' DSCRP, 'none' INF_SCP, 'none' USER_INF_SCP,<include refid="utility.now"/>REG_DT UNION SELECT 1 AUTH_TYPE, 'ROLE_ANONYMOUS' AUTH_ID, '익명 사용자' AUTH_NM, '모든 사용자' DSCRP, 'none' INF_SCP, 'none' USER_INF_SCP,<include refid="utility.now"/>REG_DT UNION
@ -25,15 +26,21 @@ SELECT * FROM (
<if test="by != null and term != null">AND ${by} LIKE CONCAT('%', #{term}, '%')</if> <if test="by != null and term != null">AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
</where> </where>
<include refid="utility.orderBy"/> <include refid="utility.orderBy"/>
<include refid="utility.paging-suffix" /></sql> <include refid="utility.paging-suffix" />
</sql>
<select id="getAuthorityList" parameterType="map" resultType="dataobject">/* 권한 목록 조회(authorityMapper.getAuthorityList) */ <select id="getAuthorityList" parameterType="map" resultType="dataobject">
<include refid="selectAuthorities" /></select> /* 권한 목록 조회(authorityMapper.getAuthorityList) */
<include refid="selectAuthorities" />
</select>
<select id="getAuthorities" parameterType="map" resultMap="authRow">/* 권한 가져오기(authorityMapper.getAuthorities) */ <select id="getAuthorities" parameterType="map" resultMap="authRow">
<include refid="selectAuthorities" /></select> /* 권한 가져오기(authorityMapper.getAuthorities) */
<include refid="selectAuthorities" />
</select>
<insert id="insertAuthority" parameterType="cokr.xit.base.security.Authority">/* 권한 등록(authorityMapper.insertAuthority) */ <insert id="insertAuthority" parameterType="cokr.xit.base.security.Authority">
/* 권한 등록(authorityMapper.insertAuthority) */
INSERT INTO TB_AUTHORITY ( INSERT INTO TB_AUTHORITY (
AUTH_ID AUTH_ID
, AUTH_NM , AUTH_NM
@ -48,30 +55,38 @@ INSERT INTO TB_AUTHORITY (
, #{infoScope} , #{infoScope}
, #{userInfoScope} , #{userInfoScope}
,<include refid="utility.now" /> ,<include refid="utility.now" />
)</insert> )
</insert>
<update id="updateAuthority" parameterType="cokr.xit.base.security.Authority">/* 권한 수정(authorityMapper.updateAuthority) */ <update id="updateAuthority" parameterType="cokr.xit.base.security.Authority">
/* 권한 수정(authorityMapper.updateAuthority) */
UPDATE TB_AUTHORITY SET UPDATE TB_AUTHORITY SET
AUTH_NM = #{name} AUTH_NM = #{name}
, DSCRP = #{description} , DSCRP = #{description}
, INF_SCP = #{infoScope} , INF_SCP = #{infoScope}
, USER_INF_SCP = #{userInfoScope} , USER_INF_SCP = #{userInfoScope}
WHERE AUTH_ID = #{id}</update> WHERE AUTH_ID = #{id}
</update>
<delete id="removeAuthorities" parameterType="map">/* 권한 삭제(authorityMapper.removeAuthorities) */ <delete id="removeAuthorities" parameterType="map">
/* 권한 삭제(authorityMapper.removeAuthorities) */
DELETE FROM TB_AUTHORITY DELETE FROM TB_AUTHORITY
WHERE AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</delete> WHERE AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)
</delete>
<select id="getActionGroupList" parameterType="map" resultType="dataobject">/* 권한-기능그룹 가져오기(authorityMapper.getActionGroups) */ <select id="getActionGroupList" parameterType="map" resultType="dataobject">
/* 권한-기능그룹 가져오기(authorityMapper.getActionGroups) */
<include refid="utility.paging-prefix" /> <include refid="utility.paging-prefix" />
SELECT A.* SELECT A.*
, (SELECT AG.GRP_NM FROM TB_ACTION_GRP AG WHERE AG.GRP_ID = A.GRP_ID) AS GRP_NM , (SELECT AG.GRP_NM FROM TB_ACTION_GRP AG WHERE AG.GRP_ID = A.GRP_ID) AS GRP_NM
FROM TB_AUTH_ACTION A FROM TB_AUTH_ACTION A
<if test="authIDs != null">WHERE AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if> <if test="authIDs != null">WHERE AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if>
ORDER BY AUTH_ID, GRP_ID ORDER BY AUTH_ID, GRP_ID
<include refid="utility.paging-suffix" /></select> <include refid="utility.paging-suffix" />
</select>
<insert id="addActionGroups" parameterType="map">/* 권한-기능그룹 추가(authorityMapper.addActionGroups) */ <insert id="addActionGroups" parameterType="map">
/* 권한-기능그룹 추가(authorityMapper.addActionGroups) */
INSERT INTO TB_AUTH_ACTION (AUTH_ID, GRP_ID, REG_DT) INSERT INTO TB_AUTH_ACTION (AUTH_ID, GRP_ID, REG_DT)
SELECT AUTH_ID, GRP_ID,<include refid="utility.now" /> SELECT AUTH_ID, GRP_ID,<include refid="utility.now" />
FROM (<foreach collection="groupIDs" item="groupID" separator=" UNION"> FROM (<foreach collection="groupIDs" item="groupID" separator=" UNION">
@ -84,7 +99,8 @@ SELECT AUTH_ID, GRP_ID,<include refid="utility.now" />
AND B.GRP_ID = A.GRP_ID AND B.GRP_ID = A.GRP_ID
)</insert> )</insert>
<delete id="removeActionGroups" parameterType="map">/* 권한-기능그룹 삭제(authorityMapper.removeActionGroups) */ <delete id="removeActionGroups" parameterType="map">
/* 권한-기능그룹 삭제(authorityMapper.removeActionGroups) */
DELETE FROM TB_AUTH_ACTION DELETE FROM TB_AUTH_ACTION
<where> <where>
<if test="authIDs != null">AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if> <if test="authIDs != null">AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if>
@ -92,7 +108,8 @@ DELETE FROM TB_AUTH_ACTION
</where> </where>
</delete> </delete>
<select id="getActionList" resultType="dataobject">/* 권한-기능 가져오기(authorityMapper.getActionList) */ <select id="getActionList" resultType="dataobject">
/* 권한-기능 가져오기(authorityMapper.getActionList) */
SELECT A.AUTH_ID SELECT A.AUTH_ID
, A.GRP_ID , A.GRP_ID
, C.ACTION , C.ACTION
@ -101,7 +118,8 @@ SELECT A.AUTH_ID
, TB_GRP_ACTION C , TB_GRP_ACTION C
WHERE A.GRP_ID = B.GRP_ID WHERE A.GRP_ID = B.GRP_ID
AND B.GRP_ID = C.GRP_ID AND B.GRP_ID = C.GRP_ID
ORDER BY A.AUTH_ID, A.GRP_ID, C.ACTION</select> ORDER BY A.AUTH_ID, A.GRP_ID, C.ACTION
</select>
<sql id="selectAuthUser"> <sql id="selectAuthUser">
<include refid="utility.paging-prefix" /> <include refid="utility.paging-prefix" />
@ -122,15 +140,21 @@ SELECT A.*
AND A.USER_ID = B.USER_ID AND A.USER_ID = B.USER_ID
</where> </where>
<include refid="utility.orderBy"/> <include refid="utility.orderBy"/>
<include refid="utility.paging-suffix" /></sql> <include refid="utility.paging-suffix" />
</sql>
<select id="getUserList" parameterType="map" resultType="dataobject">/* 권한-사용자 가져오기(authorityMapper.getUserList) */ <select id="getUserList" parameterType="map" resultType="dataobject">
<include refid="selectAuthUser" /></select> /* 권한-사용자 가져오기(authorityMapper.getUserList) */
<include refid="selectAuthUser" />
</select>
<select id="getUserAuths" parameterType="map" resultType="dataobject">/* 사용자-권한 가져오기(authorityMapper.getUserAuths) */ <select id="getUserAuths" parameterType="map" resultType="dataobject">
<include refid="selectAuthUser" /></select> /* 사용자-권한 가져오기(authorityMapper.getUserAuths) */
<include refid="selectAuthUser" />
</select>
<insert id="addUsers" parameterType="map">/* 권한-사용자 추가(authorityMapper.addUsers) */ <insert id="addUsers" parameterType="map">
/* 권한-사용자 추가(authorityMapper.addUsers) */
INSERT INTO TB_AUTH_USER (AUTH_ID, USER_ID, REG_DT) INSERT INTO TB_AUTH_USER (AUTH_ID, USER_ID, REG_DT)
SELECT AUTH_ID, USER_ID,<include refid="utility.now" /> SELECT AUTH_ID, USER_ID,<include refid="utility.now" />
FROM (<foreach collection="userIDs" item="userID" separator="UNION"> FROM (<foreach collection="userIDs" item="userID" separator="UNION">
@ -141,9 +165,11 @@ SELECT AUTH_ID, USER_ID,<include refid="utility.now" />
FROM TB_AUTH_USER B FROM TB_AUTH_USER B
WHERE B.AUTH_ID = A.AUTH_ID WHERE B.AUTH_ID = A.AUTH_ID
AND B.USER_ID = A.USER_ID AND B.USER_ID = A.USER_ID
)</insert> )
</insert>
<delete id="removeUsers" parameterType="map">/* 권한-사용자 삭제(authorityMapper.removeUsers) */ <delete id="removeUsers" parameterType="map">
/* 권한-사용자 삭제(authorityMapper.removeUsers) */
DELETE FROM TB_AUTH_USER DELETE FROM TB_AUTH_USER
<where> <where>
<if test="authIDs != null">AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if> <if test="authIDs != null">AND AUTH_ID IN (<foreach collection="authIDs" item="authID" separator=",">#{authID}</foreach>)</if>

@ -20,15 +20,21 @@
SELECT A.* SELECT A.*
FROM TB_MENU A FROM TB_MENU A
<if test='menuID != null'>WHERE MENU_NO = #{menuID}</if> <if test='menuID != null'>WHERE MENU_NO = #{menuID}</if>
ORDER BY PRNT_NO, SRT_ORD, MENU_NO</sql> ORDER BY PRNT_NO, SRT_ORD, MENU_NO
</sql>
<select id="getMenus" parameterType="map" resultMap="menuRow">/* 메뉴 정보 조회(menuMapper.getMenus) */ <select id="getMenus" parameterType="map" resultMap="menuRow">
<include refid="selectMenus" /></select> /* 메뉴 정보 조회(menuMapper.getMenus) */
<include refid="selectMenus" />
</select>
<select id="getMenu" parameterType="int" resultMap="menuRow">/* 메뉴 가져오기(menuMapper.getMenu) */ <select id="getMenu" parameterType="int" resultMap="menuRow">
<include refid="selectMenus" /></select> /* 메뉴 가져오기(menuMapper.getMenu) */
<include refid="selectMenus" />
</select>
<insert id="insertMenu" parameterType="map">/* 메뉴 등록(menuMapper.insertMenu) */ <insert id="insertMenu" parameterType="map">
/* 메뉴 등록(menuMapper.insertMenu) */
<selectKey order="BEFORE" resultType="map" keyColumn="NEW_NO,NEW_ORD" keyProperty="menu.id,menu.sortOrder"> <selectKey order="BEFORE" resultType="map" keyColumn="NEW_NO,NEW_ORD" keyProperty="menu.id,menu.sortOrder">
SELECT NEW_NO, NEW_ORD SELECT NEW_NO, NEW_ORD
FROM (SELECT NVL(MAX(MENU_NO) + 1, 0) NEW_NO FROM TB_MENU) A, FROM (SELECT NVL(MAX(MENU_NO) + 1, 0) NEW_NO FROM TB_MENU) A,
@ -57,9 +63,11 @@ INSERT INTO TB_MENU (
, #{menu.sortOrder} , #{menu.sortOrder}
,<include refid="utility.now" /> ,<include refid="utility.now" />
, #{currentUser.id} , #{currentUser.id}
)</insert> )
</insert>
<update id="updateMenu" parameterType="map">/* 메뉴 수정(menuMapper.updateMenu) */ <update id="updateMenu" parameterType="map">
/* 메뉴 수정(menuMapper.updateMenu) */
UPDATE TB_MENU SET UPDATE TB_MENU SET
MENU_NM = #{menu.name} MENU_NM = #{menu.name}
, PGRM_FILE_NM = #{menu.programFilename} , PGRM_FILE_NM = #{menu.programFilename}
@ -69,24 +77,30 @@ UPDATE TB_MENU SET
, IMG_CNF = #{menu.imageConf} , IMG_CNF = #{menu.imageConf}
WHERE MENU_NO = #{menu.id}</update> WHERE MENU_NO = #{menu.id}</update>
<sql id="newSortOrder">SELECT NVL(MAX(SRT_ORD) + 1, 0) NEW_ORD FROM TB_MENU WHERE PRNT_NO = NVL(#{parentID}, NVL(#{menu.parentID}, 0))</sql> <sql id="newSortOrder">
SELECT NVL(MAX(SRT_ORD) + 1, 0) NEW_ORD FROM TB_MENU WHERE PRNT_NO = NVL(#{parentID}, NVL(#{menu.parentID}, 0))
</sql>
<update id="moveMenus" parameterType="map">/* 메뉴 이동(menuMapper.moveMenus) */ <update id="moveMenus" parameterType="map">
/* 메뉴 이동(menuMapper.moveMenus) */
UPDATE TB_MENU SET UPDATE TB_MENU SET
PRNT_NO = #{parentID} PRNT_NO = #{parentID}
, SRT_ORD = SRT_ORD + (<include refid="newSortOrder" />) , SRT_ORD = SRT_ORD + (<include refid="newSortOrder" />)
WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>) WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>)
</update> </update>
<update id="reorderMenus" parameterType="map">/* 메뉴 순서 변경(menuMapper.reorderMenus) */ <update id="reorderMenus" parameterType="map">
/* 메뉴 순서 변경(menuMapper.reorderMenus) */
UPDATE TB_MENU SET UPDATE TB_MENU SET
SRT_ORD = CASE MENU_NO SRT_ORD = CASE MENU_NO
<foreach collection="menuIDs" item="menuID" index="index">WHEN #{menuID} THEN #{index} <foreach collection="menuIDs" item="menuID" index="index">WHEN #{menuID} THEN #{index}
</foreach> </foreach>
ELSE MENU_NO END ELSE MENU_NO END
WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>)</update> WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>)
</update>
<delete id="removeMenus" parameterType="map">/* 메뉴 제거(menuMapper.removeMenus) */ <delete id="removeMenus" parameterType="map">
/* 메뉴 제거(menuMapper.removeMenus) */
DELETE FROM TB_MENU DELETE FROM TB_MENU
WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>) WHERE MENU_NO IN (<foreach collection="menuIDs" item="menuID" separator=",">#{menuID}</foreach>)
</delete> </delete>

@ -13,7 +13,8 @@
<result property="lastModified" column="MDFCN_DT"/> <result property="lastModified" column="MDFCN_DT"/>
</resultMap> </resultMap>
<select id="getPolicyList" parameterType="map" resultType="dataobject">/* 로그인 정책 목록 조회(policyMapper.getPolicyList) */ <select id="getPolicyList" parameterType="map" resultType="dataobject">
/* 로그인 정책 목록 조회(policyMapper.getPolicyList) */
<include refid="utility.paging-prefix"/> <include refid="utility.paging-prefix"/>
SELECT A.USER_ID SELECT A.USER_ID
, USER_NM , USER_NM
@ -25,15 +26,19 @@ SELECT A.USER_ID
FROM TB_USER A LEFT OUTER JOIN TB_LOGIN_POLICY B ON A.USER_ID = B.USER_ID FROM TB_USER A LEFT OUTER JOIN TB_LOGIN_POLICY B ON A.USER_ID = B.USER_ID
<if test="term != null">WHERE A.${by} LIKE CONCAT('%', #{term}, '%')</if> <if test="term != null">WHERE A.${by} LIKE CONCAT('%', #{term}, '%')</if>
<include refid="utility.orderBy" /> <include refid="utility.orderBy" />
<include refid="utility.paging-suffix"/></select> <include refid="utility.paging-suffix"/>
</select>
<select id="getPolicies" parameterType="map" resultMap="policyRow">/* 로그인 정책 가져오기(policyMapper.getPolicies) */ <select id="getPolicies" parameterType="map" resultMap="policyRow">
/* 로그인 정책 가져오기(policyMapper.getPolicies) */
SELECT * SELECT *
FROM TB_LOGIN_POLICY FROM TB_LOGIN_POLICY
<if test="userIDs != null">WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if> <if test="userIDs != null">WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if>
ORDER BY USER_ID</select> ORDER BY USER_ID
</select>
<insert id="insertPolicy" parameterType="map">/* 로그인 정책 등록(policyMapper.insertPolicy) */ <insert id="insertPolicy" parameterType="map">
/* 로그인 정책 등록(policyMapper.insertPolicy) */
INSERT INTO TB_LOGIN_POLICY ( INSERT INTO TB_LOGIN_POLICY (
USER_ID USER_ID
, IP_ADRS , IP_ADRS
@ -52,19 +57,24 @@ INSERT INTO TB_LOGIN_POLICY (
, #{currentUser.id} , #{currentUser.id}
,<include refid="utility.now" /> ,<include refid="utility.now" />
, #{currentUser.id} , #{currentUser.id}
)</insert> )
</insert>
<update id="updatePolicy" parameterType="map">/* 로그인 정책 수정(policyMapper.updatePolicy) */ <update id="updatePolicy" parameterType="map">
/* 로그인 정책 수정(policyMapper.updatePolicy) */
UPDATE TB_LOGIN_POLICY SET UPDATE TB_LOGIN_POLICY SET
IP_ADRS = #{policy.ipAddress} IP_ADRS = #{policy.ipAddress}
, DPLCT_YN = #{policy.duplicateYN} , DPLCT_YN = #{policy.duplicateYN}
, LIMIT_YN = #{policy.limitYN} , LIMIT_YN = #{policy.limitYN}
, MDFR = #{currentUser.id} , MDFR = #{currentUser.id}
, MDFCN_DT =<include refid="utility.now" /> , MDFCN_DT =<include refid="utility.now" />
WHERE USER_ID = #{policy.userID}</update> WHERE USER_ID = #{policy.userID}
</update>
<delete id="removePolicy" parameterType="map">/* 로그인 정책 삭제(policyMapper.removePolicy) */ <delete id="removePolicy" parameterType="map">
/* 로그인 정책 삭제(policyMapper.removePolicy) */
DELETE FROM TB_LOGIN_POLICY DELETE FROM TB_LOGIN_POLICY
WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</delete> WHERE USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)
</delete>
</mapper> </mapper>

@ -16,7 +16,8 @@
<result property="ipAddress" column="IP_ADDR"/> <!-- 등록 일시 --> <result property="ipAddress" column="IP_ADDR"/> <!-- 등록 일시 -->
</resultMap> </resultMap>
<select id="getLogs" parameterType="map" resultType="dataobject">/* 시스템 로그 조회(loggingMapper.getLogs) */ <select id="getLogs" parameterType="map" resultType="dataobject">
/* 시스템 로그 조회(loggingMapper.getLogs) */
<include refid="utility.paging-prefix" /> <include refid="utility.paging-prefix" />
SELECT LOG_ID SELECT LOG_ID
, A.LOG_TYPE , A.LOG_TYPE
@ -46,17 +47,21 @@ SELECT LOG_ID
SELECT 'service' LOG_TYPE, '서비스' LOG_TYPE_NM FROM DUAL UNION SELECT 'service' LOG_TYPE, '서비스' LOG_TYPE_NM FROM DUAL UNION
SELECT 'web' LOG_TYPE, '웹' LOG_TYPE_NM FROM DUAL SELECT 'web' LOG_TYPE, '웹' LOG_TYPE_NM FROM DUAL
) C ) C
<where><if test="fromDate != null"> AND LOG_ID >= CONCAT(#{fromDate}, LPAD(0, 16, '0'))</if> <where>
<if test="fromDate != null"> AND LOG_ID >= CONCAT(#{fromDate}, LPAD(0, 16, '0'))</if>
<if test="toDate != null"> AND LOG_ID &lt;= CONCAT(#{toDate}, LPAD(9, 16, '9'))</if> <if test="toDate != null"> AND LOG_ID &lt;= CONCAT(#{toDate}, LPAD(9, 16, '9'))</if>
<if test="logTypes != null"> AND A.LOG_TYPE IN (<foreach collection="logTypes" item="logType" separator=",">#{logType}</foreach>)</if> <if test="logTypes != null"> AND A.LOG_TYPE IN (<foreach collection="logTypes" item="logType" separator=",">#{logType}</foreach>)</if>
<if test="userIDs != null"> AND USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if> <if test="userIDs != null"> AND USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if>
<if test="userAccounts != null"> AND USER_ACNT IN (<foreach collection="userAccounts" item="userAccount" separator=",">#{userAccount}</foreach>)</if> <if test="userAccounts != null"> AND USER_ACNT IN (<foreach collection="userAccounts" item="userAccount" separator=",">#{userAccount}</foreach>)</if>
<if test="userName != null"> AND USER_NM LIKE CONCAT('%', #{userName}, '%')</if> <if test="userName != null"> AND USER_NM LIKE CONCAT('%', #{userName}, '%')</if>
AND A.LOG_TYPE = C.LOG_TYPE</where> AND A.LOG_TYPE = C.LOG_TYPE
</where>
<include refid="utility.sortBy" /> <include refid="utility.sortBy" />
<include refid="utility.paging-suffix" /></select> <include refid="utility.paging-suffix" />
</select>
<insert id="insertLog" parameterType="cokr.xit.base.syslog.ServiceLog">/* 시스템 로그 등록(loggingMapper.insertLog) */ <insert id="insertLog" parameterType="cokr.xit.base.syslog.ServiceLog">
/* 시스템 로그 등록(loggingMapper.insertLog) */
<selectKey keyProperty="id" keyColumn="NEW_ID" resultType="string" order="BEFORE"> <selectKey keyProperty="id" keyColumn="NEW_ID" resultType="string" order="BEFORE">
SELECT CONCAT(TODAY, LPAD(NVL(SUBSTR(MAX(LOG_ID), 9) + 1, 1), 16, '0')) NEW_ID SELECT CONCAT(TODAY, LPAD(NVL(SUBSTR(MAX(LOG_ID), 9) + 1, 1), 16, '0')) NEW_ID
FROM TB_SYS_LOG A, (<include refid="utility.selectToday" />) B FROM TB_SYS_LOG A, (<include refid="utility.selectToday" />) B
@ -87,6 +92,7 @@ INSERT INTO TB_SYS_LOG (
, #{userId} <!-- 사용자 ID --> , #{userId} <!-- 사용자 ID -->
, #{ipAddress} <!-- IP 주소 --> , #{ipAddress} <!-- IP 주소 -->
,<include refid="utility.now" /> ,<include refid="utility.now" />
)</insert> )
</insert>
</mapper> </mapper>

@ -94,13 +94,16 @@ SELECT A.USER_ID
<include refid="utility.paging-suffix" /> <include refid="utility.paging-suffix" />
</sql> </sql>
<select id="getUserList" parameterType="map" resultType="dataobject">/* 사용자 목록 조회(userMapper.getUserList) */ <select id="getUserList" parameterType="map" resultType="dataobject">
/* 사용자 목록 조회(userMapper.getUserList) */
<include refid="selectUsers"/></select> <include refid="selectUsers"/></select>
<select id="getUsers" parameterType="map" resultMap="userRow">/* 사용자 가져오기(userMapper.getUsers) */ <select id="getUsers" parameterType="map" resultMap="userRow">
/* 사용자 가져오기(userMapper.getUsers) */
<include refid="selectUsers"/></select> <include refid="selectUsers"/></select>
<select id="getUser" parameterType="map" resultMap="userRow">/* 사용자 계정 가져오기(userMapper.getUser) */ <select id="getUser" parameterType="map" resultMap="userRow">
/* 사용자 계정 가져오기(userMapper.getUser) */
SELECT * SELECT *
FROM TB_USER FROM TB_USER
<where> <where>
@ -111,7 +114,9 @@ SELECT *
</select> </select>
<insert id="insertUser" parameterType="cokr.xit.base.user.ManagedUser"> <insert id="insertUser" parameterType="cokr.xit.base.user.ManagedUser">
<selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER</selectKey> <selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">
SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER
</selectKey>
/* 사용자 정보 등록(userMapper.insertUser) */ /* 사용자 정보 등록(userMapper.insertUser) */
INSERT INTO TB_USER ( INSERT INTO TB_USER (
USER_ID USER_ID
@ -181,7 +186,8 @@ INSERT INTO TB_USER (
, #{createdBy} , #{createdBy}
, 'Y' , 'Y'
, #{status} , #{status}
)</insert> )
</insert>
<update id="updateUser" parameterType="cokr.xit.base.user.ManagedUser"> <update id="updateUser" parameterType="cokr.xit.base.user.ManagedUser">
/* 사용자 정보 수정(userMapper.updateUser) */ /* 사용자 정보 수정(userMapper.updateUser) */

Loading…
Cancel
Save