mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-07 02:16:34 +09:00
어드민 메뉴 관리, 파티션 관리 추가
This commit is contained in:
@@ -551,4 +551,263 @@
|
||||
ORDER BY A.MENU_ODRG ASC
|
||||
</select>
|
||||
|
||||
<select id="selectPartitionTotalCnt" parameterType="kr.co.uplus.ez.api.sysMgt.dto.PartitionListReqDto" resultType="int">
|
||||
/* sysMgt-mapper.xml(selectPartitionTotalCnt) */
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.PARTITIONS
|
||||
<include refid="partitionListCondition"></include>
|
||||
</select>
|
||||
|
||||
<select id="selectPartitionList" parameterType="kr.co.uplus.ez.api.sysMgt.dto.PartitionListReqDto" resultType="kr.co.uplus.ez.api.sysMgt.dto.Partition">
|
||||
/* sysMgt-mapper.xml(selectPartitionList) */
|
||||
SELECT
|
||||
@ROWNUM := @ROWNUM + 1 AS NO
|
||||
,A.*
|
||||
FROM(
|
||||
SELECT
|
||||
TABLE_NAME
|
||||
,TABLE_SCHEMA
|
||||
,PARTITION_NAME
|
||||
,PARTITION_EXPRESSION AS PARTITION_EXP
|
||||
,PARTITION_DESCRIPTION AS PARTITION_DESC
|
||||
,PARTITION_ORDINAL_POSITION AS PARTITION_ORD_POS
|
||||
FROM INFORMATION_SCHEMA.PARTITIONS
|
||||
<include refid="partitionListCondition"></include>
|
||||
LIMIT #{page}, #{pagePerRows}) A,
|
||||
( SELECT @ROWNUM := #{page} ) AS R
|
||||
</select>
|
||||
|
||||
<sql id="partitionListCondition">
|
||||
WHERE PARTITION_NAME IS NOT NULL
|
||||
AND PARTITION_DESCRIPTION IS NOT NULL
|
||||
AND PARTITION_DESCRIPTION IS NOT NULL
|
||||
AND (SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}$' OR SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}0[0-9]|^2[0-9]{3}1[0-2]')
|
||||
<if test="deleteListView == 'true'">
|
||||
AND STR_TO_DATE(IF(SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}$',CONCAT(SUBSTRING_INDEX(PARTITION_NAME,'_',-1),'0101'),CONCAT(SUBSTRING_INDEX(PARTITION_NAME,'_',-1),'01')),'%Y%m%d') <![CDATA[ < ]]> DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -3 YEAR),'%Y%m%d')
|
||||
</if>
|
||||
<if test="searchText != null and searchText != ''">
|
||||
AND TABLE_NAME = #{searchText}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectPartitionCate" resultType="kr.co.uplus.ez.api.sysMgt.dto.Partition">
|
||||
/* sysMgt-mapper.xml(selectPartitionCate) */
|
||||
SELECT
|
||||
TABLE_NAME
|
||||
FROM INFORMATION_SCHEMA.PARTITIONS
|
||||
WHERE PARTITION_NAME IS NOT NULL
|
||||
AND PARTITION_DESCRIPTION IS NOT NULL
|
||||
AND (SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}$' OR SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}0[0-9]|^2[0-9]{3}1[0-2]')
|
||||
GROUP BY TABLE_NAME
|
||||
ORDER BY TABLE_NAME ASC
|
||||
</select>
|
||||
|
||||
<select id="selectDeletePartition" parameterType="kr.co.uplus.ez.api.sysMgt.dto.DeletePartition" resultType="kr.co.uplus.ez.api.sysMgt.dto.DeletePartition">
|
||||
/* sysMgt-mapper.xml(selectDeletePartition) */
|
||||
SELECT
|
||||
TABLE_NAME
|
||||
,TABLE_SCHEMA
|
||||
,PARTITION_NAME
|
||||
FROM INFORMATION_SCHEMA.PARTITIONS
|
||||
WHERE PARTITION_NAME IS NOT NULL
|
||||
AND PARTITION_DESCRIPTION IS NOT NULL
|
||||
AND (SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}$' OR SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}0[0-9]|^2[0-9]{3}1[0-2]')
|
||||
AND STR_TO_DATE(IF(SUBSTRING_INDEX(PARTITION_NAME,'_',-1) REGEXP '^2[0-9]{3}$',CONCAT(SUBSTRING_INDEX(PARTITION_NAME,'_',-1),'0101'),CONCAT(SUBSTRING_INDEX(PARTITION_NAME,'_',-1),'01')),'%Y%m%d') <![CDATA[ < ]]> DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -3 YEAR),'%Y%m%d')
|
||||
AND TABLE_NAME = #{tableName}
|
||||
AND PARTITION_NAME = #{partitionName}
|
||||
</select>
|
||||
|
||||
<update id="deletePartition" parameterType="kr.co.uplus.ez.api.sysMgt.dto.DeletePartition">
|
||||
/* sysMgt-mapper.xml(deletePartition) */
|
||||
ALTER TABLE ${tableSchema}.${tableName} DROP PARTITION ${partitionName}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectMenuTotalCnt" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto" resultType="int">
|
||||
/* sysMgt-mapper.xml(selectMenuTotalCnt) */
|
||||
SELECT
|
||||
COUNT(A.MENU_NO)
|
||||
FROM hubez_admin.EZ_ADM_MENU A
|
||||
,(
|
||||
SELECT
|
||||
MENU_NO
|
||||
, MENU_NM
|
||||
, MENU_ODRG
|
||||
FROM hubez_admin.EZ_ADM_MENU
|
||||
WHERE MENU_LVL = '1'
|
||||
) B
|
||||
WHERE A.PRNTS_MENU_NO = B.MENU_NO
|
||||
AND A.MENU_LVL = '2'
|
||||
<include refid="menuListCondition"></include>
|
||||
ORDER BY B.MENU_ODRG ASC, A.MENU_ODRG ASC
|
||||
</select>
|
||||
|
||||
<select id="selectMenuList" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto" resultType="kr.co.uplus.ez.api.sysMgt.dto.Menu">
|
||||
/* sysMgt-mapper.xml(selectMenuList) */
|
||||
SELECT
|
||||
A.*
|
||||
FROM (
|
||||
SELECT
|
||||
A.MENU_NO
|
||||
,A.MENU_NM
|
||||
,B.MENU_NM AS PRNTS_MENU_NM
|
||||
,A.USE_YN
|
||||
,A.MENU_URL
|
||||
,A.MENU_ODRG
|
||||
,A.AUTCHK_GRPNO
|
||||
,B.MENU_ODRG AS PRNTS_MENU_ODRG
|
||||
,DATE_FORMAT(A.REG_DT,'%Y-%m-%d %H:%i:%s') AS REG_DT
|
||||
FROM hubez_admin.EZ_ADM_MENU A
|
||||
,(
|
||||
SELECT
|
||||
MENU_NO
|
||||
, MENU_NM
|
||||
, MENU_ODRG
|
||||
FROM hubez_admin.EZ_ADM_MENU
|
||||
WHERE MENU_LVL = '1'
|
||||
) B
|
||||
WHERE A.PRNTS_MENU_NO = B.MENU_NO
|
||||
AND A.MENU_LVL = '2'
|
||||
<include refid="menuListCondition"></include>
|
||||
) A
|
||||
ORDER BY A.PRNTS_MENU_ODRG ASC, A.MENU_ODRG ASC
|
||||
</select>
|
||||
|
||||
<sql id="menuListCondition">
|
||||
<if test="searchText != null and searchText != ''">
|
||||
AND A.PRNTS_MENU_NO = #{searchText}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectMenuCate" resultType="kr.co.uplus.ez.api.sysMgt.dto.Menu">
|
||||
/* sysMgt-mapper.xml(selectMenuCate) */
|
||||
SELECT
|
||||
MENU_NO
|
||||
, MENU_NM
|
||||
, MENU_ODRG
|
||||
FROM hubez_admin.EZ_ADM_MENU
|
||||
WHERE MENU_LVL = '1'
|
||||
ORDER BY MENU_ODRG ASC
|
||||
</select>
|
||||
|
||||
<select id="selectMenuDetail" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto" resultType="kr.co.uplus.ez.api.sysMgt.dto.Menu">
|
||||
/* sysMgt-mapper.xml(selectMenuDetail) */
|
||||
SELECT
|
||||
A.MENU_NO
|
||||
,A.MENU_NM
|
||||
,A.MENU_URL
|
||||
,A.USE_YN
|
||||
,A.MENU_ODRG
|
||||
,A.PRNTS_MENU_NO
|
||||
,A.AUTCHK_GRPNO
|
||||
,MAX(B.MENU_ODRG) AS MAX_MENU_ODRG
|
||||
FROM hubez_admin.EZ_ADM_MENU A, hubez_admin.EZ_ADM_MENU B
|
||||
WHERE A.PRNTS_MENU_NO = B.PRNTS_MENU_NO
|
||||
AND A.MENU_NO = #{menuNo}
|
||||
GROUP BY A.MENU_NO
|
||||
</select>
|
||||
|
||||
<select id="getMenuNo" resultType="String">
|
||||
/* sysMgt-mapper.xml(getMenuNo) */
|
||||
SELECT (MAX(MENU_NO)+1) AS MENU_NO FROM hubez_admin.EZ_ADM_MENU A
|
||||
</select>
|
||||
|
||||
<insert id="insertMenu" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto">
|
||||
/* sysMgt-mapper.xml(insertMenu) */
|
||||
INSERT INTO hubez_admin.EZ_ADM_MENU
|
||||
(
|
||||
MENU_NO
|
||||
, PRNTS_MENU_NO
|
||||
, MENU_NM
|
||||
, MENU_ODRG
|
||||
, USE_YN
|
||||
, MENU_LVL
|
||||
, MENU_URL
|
||||
<if test="autchkGrpno != null and autchkGrpno != ''">
|
||||
, AUTCHK_GRPNO
|
||||
</if>
|
||||
, REG_ID
|
||||
, REG_DT
|
||||
, CHG_ID
|
||||
, CHG_DT
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{menuNo}
|
||||
, #{prntsMenuNo}
|
||||
, #{menuNm}
|
||||
, (SELECT MAX(MENU_ODRG)+1 FROM hubez_admin.EZ_ADM_MENU A WHERE PRNTS_MENU_NO = #{prntsMenuNo})
|
||||
, #{useYn}
|
||||
, 2
|
||||
, #{menuUrl}
|
||||
<if test="autchkGrpno != null and autchkGrpno != ''">
|
||||
, #{autchkGrpno}
|
||||
</if>
|
||||
, #{regId}
|
||||
, NOW()
|
||||
, #{regId}
|
||||
, NOW()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteMenu" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto">
|
||||
/* sysMgt-mapper.xml(deleteMenu) */
|
||||
DELETE FROM hubez_admin.EZ_ADM_MENU
|
||||
WHERE MENU_NO = #{menuNo}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAuthMenuFromMenu" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto">
|
||||
/* sysMgt-mapper.xml(deleteAuthMenuFromMenu) */
|
||||
DELETE FROM hubez_admin.EZ_ADM_AUTMENU
|
||||
WHERE MENU_NO = #{menuNo}
|
||||
</delete>
|
||||
|
||||
<update id="updateMenuOdrg" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto">
|
||||
/* sysMgt-mapper.xml(updateMenuOdrg) */
|
||||
UPDATE hubez_admin.EZ_ADM_MENU
|
||||
SET
|
||||
<choose>
|
||||
<when test="oldMenuOdrg != null and oldMenuOdrg != ''">
|
||||
<choose>
|
||||
<when test="oldMenuOdrg lt menuOdrg">
|
||||
MENU_ODRG = IF(MENU_ODRG <![CDATA[ <= ]]> #{menuOdrg} AND MENU_ODRG <![CDATA[ > ]]> #{oldMenuOdrg}, MENU_ODRG-1, IF(MENU_ODRG = #{oldMenuOdrg} , #{menuOdrg},MENU_ODRG))
|
||||
</when>
|
||||
<when test="oldMenuOdrg gt menuOdrg">
|
||||
MENU_ODRG = IF(MENU_ODRG <![CDATA[ < ]]> #{oldMenuOdrg} AND MENU_ODRG <![CDATA[ >= ]]> #{menuOdrg}, MENU_ODRG+1, IF(MENU_ODRG = #{oldMenuOdrg} , #{menuOdrg},MENU_ODRG))
|
||||
</when>
|
||||
</choose>
|
||||
</when>
|
||||
<otherwise>
|
||||
MENU_ODRG = MENU_ODRG - 1
|
||||
</otherwise>
|
||||
</choose>
|
||||
,CHG_ID = #{chgId}
|
||||
,CHG_DT = NOW()
|
||||
WHERE PRNTS_MENU_NO = #{prntsMenuNo}
|
||||
<if test="!(oldMenuOdrg != null and oldMenuOdrg != '')">
|
||||
AND MENU_ODRG <![CDATA[ > ]]> #{menuOdrg}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="updateMenu" parameterType="kr.co.uplus.ez.api.sysMgt.dto.MenuListReqDto">
|
||||
/* sysMgt-mapper.xml(updateMenu) */
|
||||
UPDATE hubez_admin.EZ_ADM_MENU
|
||||
SET
|
||||
MENU_NM = #{menuNm}
|
||||
,MENU_URL = #{menuUrl}
|
||||
,USE_YN = #{useYn}
|
||||
<choose>
|
||||
<when test="autchkGrpno != null and autchkGrpno != ''">
|
||||
,AUTCHK_GRPNO = #{autchkGrpno}
|
||||
</when>
|
||||
<otherwise>
|
||||
,AUTCHK_GRPNO = null
|
||||
</otherwise>
|
||||
</choose>
|
||||
,CHG_ID = #{chgId}
|
||||
,CHG_DT = NOW()
|
||||
WHERE MENU_NO = #{menuNo}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user