From 28b54fcc47d3e38d558ec6399d5894c19d4fcfd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Tue, 16 Jan 2024 17:59:52 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EB=A9=94=EB=89=B4=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/css/page.css | 20 +++---- .../src/pages/admin/config/MenuMgt.jsx | 58 +++++++++++++++++-- .../yarn.lock | 5 ++ 3 files changed, 67 insertions(+), 16 deletions(-) diff --git a/egovframe-template-simple-react-contribution/src/css/page.css b/egovframe-template-simple-react-contribution/src/css/page.css index 791049e..b7e4d67 100644 --- a/egovframe-template-simple-react-contribution/src/css/page.css +++ b/egovframe-template-simple-react-contribution/src/css/page.css @@ -170,26 +170,22 @@ .userList .result .list_item > div:nth-child(7) {width: 100px;} /* 사이트관리 > 환경설정 > 메뉴관리 */ - .menuList .head > span:nth-child(1) {width: 60px;} - .menuList .head > span:nth-child(2) {width: 100px;} + .menuList .head > span:nth-child(1) {width: 100px;} + .menuList .head > span:nth-child(2) {width: 150px;} .menuList .head > span:nth-child(3) {width: 100px;} - .menuList .head > span:nth-child(4) {width: 120px;} + .menuList .head > span:nth-child(4) {width: 100px;} .menuList .head > span:nth-child(5) {width: 100px;} - .menuList .head > span:nth-child(6) {width: 100px;} + .menuList .head > span:nth-child(6) {width: 200px;} .menuList .head > span:nth-child(7) {width: 100px;} .menuList .head > span:nth-child(8) {width: 100px;} - .menuList .head > span:nth-child(9) {width: 100px;} - .menuList .head > span:nth-child(10) {width: 100px;} - .menuList .result .list_item > div:nth-child(1) {width: 60px;} - .menuList .result .list_item > div:nth-child(2) {width: 100px;} + .menuList .result .list_item > div:nth-child(1) {width: 100px;} + .menuList .result .list_item > div:nth-child(2) {width: 150px;} .menuList .result .list_item > div:nth-child(3) {width: 100px;} - .menuList .result .list_item > div:nth-child(4) {width: 120px;} + .menuList .result .list_item > div:nth-child(4) {width: 100px;} .menuList .result .list_item > div:nth-child(5) {width: 100px;} - .menuList .result .list_item > div:nth-child(6) {width: 100px;} + .menuList .result .list_item > div:nth-child(6) {width: 200px;} .menuList .result .list_item > div:nth-child(7) {width: 100px;} .menuList .result .list_item > div:nth-child(8) {width: 100px;} - .menuList .result .list_item > div:nth-child(9) {width: 100px;} - .menuList .result .list_item > div:nth-child(10) {width: 100px;} /* 사이트소개 */ .SITE_INTRO .ds_1 .t_1 {margin-top: 52px; color: #000; font-size: 26px; font-weight: 500; text-align: center;} diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx index 450794f..777b8bd 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx @@ -3,10 +3,62 @@ import {Link} from "react-router-dom"; import URL from "constants/url"; import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin'; +import * as EgovNet from "../../../api/egovFetch"; function MenuMgt({}) { + const [listTag, setListTag] = useState([]); + + const retrieveList = useCallback(() => { + EgovNet.requestFetch( + '/admin/config/menu-mgt', + { + method: "GET" + }, + (resp) => { + let mutListTag = []; + + setListTag([]); + // 리스트 항목 구성 + resp.result.menuList.forEach(function (item, index) { + mutListTag.push( +
+
{item.menuId}
+
{item.menuTitle}
+
{item.menuGroup}
+
{item.menuLevel}
+
{item.menuSort}
+
{item.menuUrl}
+
{item.menuTypeCd}
+
+ + +
+
+ ); + }); + if(!mutListTag.length) mutListTag.push(

검색된 결과가 없습니다.

); // 게시판 목록 초기값 + setListTag(mutListTag); + }, + function (resp) { + console.log("err response : ", resp); + } + ); + },[]); + + function saveMenu(){ + + } + + function removeMenu(menuId){ + + } + + useEffect(()=>{ + retrieveList(); + }, []) + return (
@@ -38,12 +90,10 @@ function MenuMgt({}) { 정렬 URI 타입 - CSS - IMG - 삭제 +
- {/*{listTag}*/} + {listTag}
diff --git a/egovframe-template-simple-react-contribution/yarn.lock b/egovframe-template-simple-react-contribution/yarn.lock index f28171d..7dc6b39 100644 --- a/egovframe-template-simple-react-contribution/yarn.lock +++ b/egovframe-template-simple-react-contribution/yarn.lock @@ -4068,6 +4068,11 @@ date-fns@^2.24.0: resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz" integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA== +date-fns@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.2.0.tgz#c97cf685b62c829aa4ecba554e4a51768cf0bffc" + integrity sha512-E4KWKavANzeuusPi0jUjpuI22SURAznGkx7eZV+4i6x2A+IZxAMcajgkvuDAU1bg40+xuhW1zRdVIIM/4khuIg== + debug@2.6.9, debug@^2.6.0: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" From f7ba2ef68b07ab91129ba48b4ea1619d5936fced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Wed, 17 Jan 2024 17:57:58 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=EB=A9=94=EB=89=B4=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/css/page.css | 8 +- .../src/pages/admin/config/MenuMgt.jsx | 27 ++++-- .../pages/admin/config/menuMgt/MenuModal.jsx | 96 +++++++++++++++++++ 3 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx diff --git a/egovframe-template-simple-react-contribution/src/css/page.css b/egovframe-template-simple-react-contribution/src/css/page.css index b7e4d67..a1a2616 100644 --- a/egovframe-template-simple-react-contribution/src/css/page.css +++ b/egovframe-template-simple-react-contribution/src/css/page.css @@ -173,16 +173,16 @@ .menuList .head > span:nth-child(1) {width: 100px;} .menuList .head > span:nth-child(2) {width: 150px;} .menuList .head > span:nth-child(3) {width: 100px;} - .menuList .head > span:nth-child(4) {width: 100px;} - .menuList .head > span:nth-child(5) {width: 100px;} + .menuList .head > span:nth-child(4) {width: 60px;} + .menuList .head > span:nth-child(5) {width: 60px;} .menuList .head > span:nth-child(6) {width: 200px;} .menuList .head > span:nth-child(7) {width: 100px;} .menuList .head > span:nth-child(8) {width: 100px;} .menuList .result .list_item > div:nth-child(1) {width: 100px;} .menuList .result .list_item > div:nth-child(2) {width: 150px;} .menuList .result .list_item > div:nth-child(3) {width: 100px;} - .menuList .result .list_item > div:nth-child(4) {width: 100px;} - .menuList .result .list_item > div:nth-child(5) {width: 100px;} + .menuList .result .list_item > div:nth-child(4) {width: 60px;} + .menuList .result .list_item > div:nth-child(5) {width: 60px;} .menuList .result .list_item > div:nth-child(6) {width: 200px;} .menuList .result .list_item > div:nth-child(7) {width: 100px;} .menuList .result .list_item > div:nth-child(8) {width: 100px;} diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx index 777b8bd..b499f2a 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx @@ -4,12 +4,20 @@ import URL from "constants/url"; import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin'; import * as EgovNet from "../../../api/egovFetch"; +import Modal from "react-bootstrap/Modal"; +import MenuModal from "./menuMgt/MenuModal"; function MenuMgt({}) { const [listTag, setListTag] = useState([]); + const [show, setShow] = useState(false); + const [modalBody, setModalBody] = useState(); + + const handleClose = () => setShow(false); + const handleShow = () => setShow(true); + const retrieveList = useCallback(() => { EgovNet.requestFetch( '/admin/config/menu-mgt', @@ -32,8 +40,7 @@ function MenuMgt({}) {
{item.menuUrl}
{item.menuTypeCd}
- - +
); @@ -47,12 +54,9 @@ function MenuMgt({}) { ); },[]); - function saveMenu(){ - - } - - function removeMenu(menuId){ - + function editMenu(menu){ + handleShow(); + setModalBody() } useEffect(()=>{ @@ -90,7 +94,9 @@ function MenuMgt({}) { 정렬 URI 타입 - + + +
{listTag} @@ -99,6 +105,9 @@ function MenuMgt({}) {
+ + {modalBody} + ); } diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx new file mode 100644 index 0000000..1aa7ba7 --- /dev/null +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx @@ -0,0 +1,96 @@ +import react from "react" +import Modal from "react-bootstrap/Modal"; +import Form from "react-bootstrap/Form"; +import Row from "react-bootstrap/Row"; +import Col from "react-bootstrap/Col"; +import React from "react"; + +function MenuModal({savedInfo}){ + + function editMenu(e){ + + } + + function deleteMenu(menuId){ + + } + + return ( + <> + + + {savedInfo!==undefined?`${savedInfo?.menuTitle} 상세정보`:'메뉴 생성'} + + + +
{editMenu(e)}} noValidate> + + + 아이디 + + + + + + + + 이름 + + + + + + + + 그룹 + + + + + + + + 레벨 + + + + + + + + 정렬 + + + + + + + + URI + + + + + + + + 타입 + + + + + + + {savedInfo !== undefined?:''} + + + + + +
+
+ + ); +} + +export default MenuModal; \ No newline at end of file From e1b715188d607d744850796bfdeb64453431714f Mon Sep 17 00:00:00 2001 From: "Lim\\jun" Date: Thu, 18 Jan 2024 15:13:32 +0900 Subject: [PATCH 3/4] =?UTF-8?q?react-csv=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../package-lock.json | 11 +++++++++++ .../package.json | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/egovframe-template-simple-react-contribution/package-lock.json b/egovframe-template-simple-react-contribution/package-lock.json index c437d82..6a903d3 100644 --- a/egovframe-template-simple-react-contribution/package-lock.json +++ b/egovframe-template-simple-react-contribution/package-lock.json @@ -17,6 +17,7 @@ "qs": "^6.11.0", "react": "^18.2.0", "react-bootstrap": "^2.9.0", + "react-csv": "^2.2.2", "react-datepicker": "^4.8.0", "react-dom": "^18.2.0", "react-icons": "^4.11.0", @@ -14987,6 +14988,11 @@ } } }, + "node_modules/react-csv": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.2.2.tgz", + "integrity": "sha512-RG5hOcZKZFigIGE8LxIEV/OgS1vigFQT4EkaHeKgyuCbUAu9Nbd/1RYq++bJcJJ9VOqO/n9TZRADsXNDR4VEpw==" + }, "node_modules/react-datepicker": { "version": "4.10.0", "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-4.10.0.tgz", @@ -29021,6 +29027,11 @@ "warning": "^4.0.3" } }, + "react-csv": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.2.2.tgz", + "integrity": "sha512-RG5hOcZKZFigIGE8LxIEV/OgS1vigFQT4EkaHeKgyuCbUAu9Nbd/1RYq++bJcJJ9VOqO/n9TZRADsXNDR4VEpw==" + }, "react-datepicker": { "version": "4.10.0", "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-4.10.0.tgz", diff --git a/egovframe-template-simple-react-contribution/package.json b/egovframe-template-simple-react-contribution/package.json index 23ee0c8..6a94442 100644 --- a/egovframe-template-simple-react-contribution/package.json +++ b/egovframe-template-simple-react-contribution/package.json @@ -20,7 +20,8 @@ "recharts": "^2.10.3", "styled-components": "^6.0.9", "web-vitals": "^2.1.4", - "date-fns": "^3.2.0" + "date-fns": "^3.2.0", + "react-csv": "^2.2.2" }, "devDependencies": { "@testing-library/jest-dom": "^5.16.4", From e23f997e8d35663e3dd0483b5e30f9fa18a9c6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Thu, 18 Jan 2024 17:48:55 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=EB=A9=94=EB=89=B4=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=20=EC=99=84=EB=A3=8C.=20=EB=A9=94=EB=89=B4?= =?UTF-8?q?=20=EA=B6=8C=ED=95=9C=20=EA=B4=80=EB=A6=AC=20=EC=9E=91=EC=97=85?= =?UTF-8?q?=EC=A4=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/css/page.css | 20 ++++ .../src/pages/admin/config/MenuAuthMgt.jsx | 91 ++++++++++++++++++- .../src/pages/admin/config/MenuMgt.jsx | 13 +-- .../pages/admin/config/menuMgt/MenuModal.jsx | 78 +++++++++++++--- .../admin/config/AdminConfigController.java | 70 ++++++++++++++ .../admin/config/entity/TcMenu.java | 17 ++-- .../admin/config/mapper/TcMenuMapper.java | 13 +++ .../config/service/AdminConfigService.java | 40 +++++++- .../resources/mybatisMapper/TcMenuMapper.xml | 27 ++++++ 9 files changed, 342 insertions(+), 27 deletions(-) create mode 100644 kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/mapper/TcMenuMapper.java create mode 100644 kcsc-back-end/src/main/resources/mybatisMapper/TcMenuMapper.xml diff --git a/egovframe-template-simple-react-contribution/src/css/page.css b/egovframe-template-simple-react-contribution/src/css/page.css index a1a2616..54ec026 100644 --- a/egovframe-template-simple-react-contribution/src/css/page.css +++ b/egovframe-template-simple-react-contribution/src/css/page.css @@ -187,6 +187,26 @@ .menuList .result .list_item > div:nth-child(7) {width: 100px;} .menuList .result .list_item > div:nth-child(8) {width: 100px;} + /* 사이트관리 > 환경설정 > 메뉴관리 */ + .menuList .head > span:nth-child(1) {width: 100px;} + .menuList .head > span:nth-child(2) {width: 150px;} + .menuList .head > span:nth-child(3) {width: 100px;} + .menuList .head > span:nth-child(4) {width: 60px;} + .menuList .head > span:nth-child(5) {width: 60px;} + .menuList .head > span:nth-child(6) {width: 60px;} + .menuList .head > span:nth-child(7) {width: 60px;} + .menuList .head > span:nth-child(8) {width: 60px;} + .menuList .head > span:nth-child(9) {width: 100px;} + .menuList .result .list_item > div:nth-child(1) {width: 100px;} + .menuList .result .list_item > div:nth-child(2) {width: 150px;} + .menuList .result .list_item > div:nth-child(3) {width: 100px;} + .menuList .result .list_item > div:nth-child(4) {width: 60px;} + .menuList .result .list_item > div:nth-child(5) {width: 60px;} + .menuList .result .list_item > div:nth-child(6) {width: 60px;} + .menuList .result .list_item > div:nth-child(7) {width: 60px;} + .menuList .result .list_item > div:nth-child(8) {width: 60px;} + .menuList .result .list_item > div:nth-child(9) {width: 100px;} + /* 사이트소개 */ .SITE_INTRO .ds_1 .t_1 {margin-top: 52px; color: #000; font-size: 26px; font-weight: 500; text-align: center;} .SITE_INTRO .ds_1 .li_1 {position: relative; margin-top: 34px; font-size: 0; text-align: center;} diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuAuthMgt.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuAuthMgt.jsx index bed7be2..97791e7 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuAuthMgt.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuAuthMgt.jsx @@ -1,11 +1,98 @@ -import React from 'react'; +import React, {useCallback, useEffect, useState} from 'react'; +import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin'; +import {Link} from "react-router-dom"; +import URL from "constants/url"; +import * as EgovNet from "api/egovFetch"; function MenuAuthMgt(props) { + const [listTag, setListTag] = useState([]); + + const retrieveList = useCallback(() => { + EgovNet.requestFetch( + '/admin/config/menu-auth-mgt', + { + method: "GET" + }, + (resp) => { + let mutListTag = []; + + setListTag([]); + // 리스트 항목 구성 + resp.result.menuList.forEach(function (item, index) { + mutListTag.push( +
+
{item.menuId}
+
{item.menuTitle}
+
{item.menuGroup}
+
{item.menuLevel}
+
{item.menuSort}
+
{item.menuUrl}
+
{item.menuTypeValue}
+
+ +
+
+ ); + }); + if(!mutListTag.length) mutListTag.push(

검색된 결과가 없습니다.

); // 게시판 목록 초기값 + setListTag(mutListTag); + }, + function (resp) { + console.log("err response : ", resp); + } + ); + },[]); + + function editMenu(menu){ + + } + + useEffect(()=>{ + /*retrieveList();*/ + }, []) return (
- MenuAuthMgt +
+
+
    +
  • Home
  • +
  • 사이트관리
  • +
  • 환경설정
  • +
  • 메뉴 권한 관리
  • +
+
+
+ {/* */} + +
+ {/* */} + +
+

메뉴 관리

+
+

+ +
+
+ 메뉴 코드 + 메뉴 이름 + 부모 메뉴 + 레벨1 + 레벨2 + 레벨3 + 레벨4 + 레벨5 + +
+
+ {listTag} +
+
+
+
+
); } diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx index b499f2a..78d62b7 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/MenuMgt.jsx @@ -19,6 +19,7 @@ function MenuMgt({}) { const handleShow = () => setShow(true); const retrieveList = useCallback(() => { + handleClose() EgovNet.requestFetch( '/admin/config/menu-mgt', { @@ -38,7 +39,7 @@ function MenuMgt({}) {
{item.menuLevel}
{item.menuSort}
{item.menuUrl}
-
{item.menuTypeCd}
+
{item.menuTypeValue}
@@ -56,7 +57,7 @@ function MenuMgt({}) { function editMenu(menu){ handleShow(); - setModalBody() + setModalBody() } useEffect(()=>{ @@ -71,7 +72,7 @@ function MenuMgt({}) {
  • Home
  • 사이트관리
  • 환경설정
  • -
  • 메뉴 관리
  • +
  • 메뉴 관리
  • @@ -87,9 +88,9 @@ function MenuMgt({}) {
    - 아이디 - 이름 - 그룹 + 메뉴 코드 + 메뉴 이름 + 부모 메뉴 레벨 정렬 URI diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx index 1aa7ba7..55087f8 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/menuMgt/MenuModal.jsx @@ -1,18 +1,72 @@ -import react from "react" +import React from "react"; import Modal from "react-bootstrap/Modal"; import Form from "react-bootstrap/Form"; import Row from "react-bootstrap/Row"; import Col from "react-bootstrap/Col"; -import React from "react"; +import SelectOption from "components/commonCode/SelectOption"; +import * as EgovNet from "api/egovFetch"; +import CODE from "constants/code"; -function MenuModal({savedInfo}){ +function MenuModal({savedInfo, reloadFunction}){ function editMenu(e){ - + e.preventDefault(); + e.stopPropagation(); + const form = e.target; + const info = { + menuId: form.menuId.value, + menuTitle: form.menuTitle.value, + menuGroup: form.menuGroup.value, + menuLevel: form.menuLevel.value, + menuSort: form.menuSort.value, + menuUrl: form.menuUrl.value, + menuTypeCd: form.menuTypeCd.value, + } + EgovNet.requestFetch( + '/admin/config/menu-mgt', + { + method: "PUT", + headers: { + 'Content-type': 'application/json' + }, + body: JSON.stringify(info) + }, + (resp) => { + if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) { + alert("저장되었습니다.") + reloadFunction(); + }else if(Number(resp.resultCode) === Number(CODE.RCV_ERROR_AUTH)){ + console.log("토큰 갱신중.") + }else{ + alert(resp.result.resultMessage) + } + } + ) } function deleteMenu(menuId){ - + if(window.confirm("삭제하시겠습니까?")) { + EgovNet.requestFetch( + '/admin/config/menu-mgt', + { + method: "DELETE", + headers: { + 'Content-type': 'application/json' + }, + body: JSON.stringify({menuId: menuId}) + }, + (resp) => { + if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) { + alert("삭제되었습니다.") + reloadFunction(); + } else if (Number(resp.resultCode) === Number(CODE.RCV_ERROR_AUTH)) { + console.log("토큰 갱신중.") + } else { + alert(resp.result.resultMessage) + } + } + ) + } } return ( @@ -26,15 +80,15 @@ function MenuModal({savedInfo}){
    {editMenu(e)}} noValidate> - 아이디 + 메뉴 코드 - + - 이름 + 메뉴 이름 @@ -42,7 +96,7 @@ function MenuModal({savedInfo}){ - 그룹 + 부모 메뉴 @@ -53,7 +107,7 @@ function MenuModal({savedInfo}){ 레벨 - + @@ -61,7 +115,7 @@ function MenuModal({savedInfo}){ 정렬 - + @@ -77,7 +131,7 @@ function MenuModal({savedInfo}){ 타입 - + diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java index 9868803..c0cbc28 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java @@ -1,5 +1,6 @@ package com.dbnt.kcscbackend.admin.config; +import com.dbnt.kcscbackend.admin.config.entity.TcMenu; import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp; import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem; import com.dbnt.kcscbackend.admin.config.service.AdminConfigService; @@ -14,11 +15,14 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.validation.Errors; +import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import javax.validation.Valid; import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; @@ -232,4 +236,70 @@ public class AdminConfigController extends BaseController { resultVO.setResult(resultMap); return resultVO; } + + @Operation( + summary = "메뉴 저장", + description = "메뉴 저장", + tags = {"AdminConfigController"} + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "저장 성공"), + @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님") + }) + @RequestMapping(method = RequestMethod.PUT, value = "/menu-mgt") + public ResultVO saveMenuMgt(@RequestBody @Valid TcMenu menu, Errors errors, @AuthenticationPrincipal LoginVO user){ + ResultVO resultVO = new ResultVO(); + if(user == null){ + resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode()); + }else { + menu.setRoleGrpId(menu.getMenuTypeCd().equals("MNU_0000")?"ADMIN_USER":"ALL_USER"); + if(errors.hasErrors()){ + StringBuilder msg = new StringBuilder(); + for(FieldError error: errors.getFieldErrors()){ + msg.append(error.getDefaultMessage()); + msg.append("\n"); + } + resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode()); + resultVO.setResultMessage(msg.toString()); + }else if (!user.getUserSe().equals("ACC_TP01")) { + resultVO.setResultCode(ResponseCode.AUTH_ERROR.getCode()); + resultVO.setResultMessage(ResponseCode.AUTH_ERROR.getMessage()); + } else { + adminConfigService.saveMenu(menu, user.getId()); + resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); + } + } + return resultVO; + } + + @Operation( + summary = "메뉴 삭제", + description = "메뉴 삭제", + tags = {"AdminConfigController"} + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "삭제 성공"), + @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님") + }) + @RequestMapping(method = RequestMethod.DELETE, value = "/menu-mgt") + public ResultVO removeMenuMgt(@RequestBody TcMenu menu, @AuthenticationPrincipal LoginVO user){ + ResultVO resultVO = new ResultVO(); + if(user == null){ + resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode()); + }else { + if (!user.getUserSe().equals("ACC_TP01")) { + resultVO.setResultCode(ResponseCode.AUTH_ERROR.getCode()); + resultVO.setResultMessage(ResponseCode.AUTH_ERROR.getMessage()); + } else { + String result = adminConfigService.deleteMenu(menu.getMenuId(), user.getId()); + if(result==null){ + resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); + }else if(result.equals("notFind")){ + resultVO.setResultCode(ResponseCode.SAVE_ERROR.getCode()); + resultVO.setResultMessage("대상이 존재하지 않습니다."); + } + } + } + return resultVO; + } } diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TcMenu.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TcMenu.java index 754939b..90a3733 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TcMenu.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TcMenu.java @@ -7,10 +7,8 @@ import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import org.springframework.format.annotation.DateTimeFormat; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.persistence.*; +import javax.validation.constraints.NotBlank; import java.time.LocalDateTime; @Getter @@ -23,20 +21,24 @@ import java.time.LocalDateTime; public class TcMenu { @Id @Column(name = "menu_id") + @NotBlank(message = "메뉴코드를 입력해주세요.") private String menuId; @Column(name = "role_grp_id") private String roleGrpId; @Column(name = "menu_title") + @NotBlank(message = "메뉴이름을 입력해주세요.") private String menuTitle; @Column(name = "menu_group") private String menuGroup; @Column(name = "menu_level") - private String menuLevel; + private Integer menuLevel; @Column(name = "menu_sort") - private String menuSort; + private Integer menuSort; @Column(name = "menu_url") + @NotBlank(message = "메뉴URI를 입력해주세요.") private String menuUrl; @Column(name = "menu_type_cd") + @NotBlank(message = "타입을 선택해주세요.") private String menuTypeCd; @Column(name = "frst_crt_id") private String frstCrtId; @@ -50,4 +52,7 @@ public class TcMenu { private LocalDateTime lastChgDt; @Column(name = "use_yn") private String useYn; + + @Transient + private String menuTypeValue; } diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/mapper/TcMenuMapper.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/mapper/TcMenuMapper.java new file mode 100644 index 0000000..e8dd179 --- /dev/null +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/mapper/TcMenuMapper.java @@ -0,0 +1,13 @@ +package com.dbnt.kcscbackend.admin.config.mapper; + +import com.dbnt.kcscbackend.admin.config.entity.TcMenu; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface TcMenuMapper { + + List selectMenuList(); + +} diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java index 9e25549..2f58a45 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java @@ -1,6 +1,7 @@ package com.dbnt.kcscbackend.admin.config.service; import com.dbnt.kcscbackend.admin.config.entity.TcMenu; +import com.dbnt.kcscbackend.admin.config.mapper.TcMenuMapper; import com.dbnt.kcscbackend.admin.config.repository.TcMenuRepository; import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp; import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem; @@ -11,6 +12,7 @@ import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.List; @Service @@ -20,6 +22,7 @@ public class AdminConfigService extends EgovAbstractServiceImpl { private final TcCodeGrpRepository codeGrpRepository; private final TcCodeItemRepository codeItemRepository; private final TcMenuRepository menuRepository; + private final TcMenuMapper menuMapper; public List selectCodeGrpList(){ return codeGrpRepository.findByUseYn("Y"); @@ -100,6 +103,41 @@ public class AdminConfigService extends EgovAbstractServiceImpl { } public List selectMenuList() { - return menuRepository.findByUseYnOrderByMenuIdAsc("Y"); + return menuMapper.selectMenuList(); + } + + @Transactional + public void saveMenu(TcMenu menu, String userId) { + TcMenu savedMenu = menuRepository.findById(menu.getMenuId()).orElse(null); + if(savedMenu==null){ + menu.setFrstCrtDt(LocalDateTime.now()); + menu.setFrstCrtId(userId); + menu.setUseYn("Y"); + menuRepository.save(menu); + }else{ + savedMenu.setMenuTitle(menu.getMenuTitle()); + savedMenu.setMenuGroup(menu.getMenuGroup()); + savedMenu.setMenuLevel(menu.getMenuLevel()); + savedMenu.setMenuSort(menu.getMenuSort()); + savedMenu.setMenuUrl(menu.getMenuUrl()); + savedMenu.setMenuTypeCd(menu.getMenuTypeCd()); + savedMenu.setUseYn("Y"); + savedMenu.setLastChgId(userId); + savedMenu.setLastChgDt(LocalDateTime.now()); + menuRepository.save(savedMenu); + } + } + + @Transactional + public String deleteMenu(String menuId, String userId) { + TcMenu savedMenu = menuRepository.findById(menuId).orElse(null); + if(savedMenu==null){ + return "notFind"; + }else{ + savedMenu.setUseYn("N"); + savedMenu.setLastChgDt(LocalDateTime.now()); + savedMenu.setLastChgId(userId); + return null; + } } } diff --git a/kcsc-back-end/src/main/resources/mybatisMapper/TcMenuMapper.xml b/kcsc-back-end/src/main/resources/mybatisMapper/TcMenuMapper.xml new file mode 100644 index 0000000..9258f88 --- /dev/null +++ b/kcsc-back-end/src/main/resources/mybatisMapper/TcMenuMapper.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file