From 92b01751bf8b51626cfd214b9f1840142926be64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E7=8B=BC=E8=93=9D=E5=A4=A9?= Date: Mon, 4 Nov 2024 17:09:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8F=9C=E5=8D=95=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../harmony/controller/SystemController.java | 4 ++++ .../harmony/service/SystemService.java | 2 ++ .../harmony/service/impl/SystemServiceImpl.java | 15 +++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/main/java/com/guaiguailang/harmony/controller/SystemController.java b/src/main/java/com/guaiguailang/harmony/controller/SystemController.java index dbfba90..8d66e94 100644 --- a/src/main/java/com/guaiguailang/harmony/controller/SystemController.java +++ b/src/main/java/com/guaiguailang/harmony/controller/SystemController.java @@ -38,5 +38,9 @@ public class SystemController { public ResponseEntity updateMenu(@RequestBody MenuDataItem menuDataItem) { return ResponseEntity.ok(systemService.updateMenu(menuDataItem)); } + @PostMapping("/menu-add") + public ResponseEntity addMenu(@RequestBody MenuDataItem menuDataItem) { + return ResponseEntity.ok(systemService.addMenu(menuDataItem)); + } } diff --git a/src/main/java/com/guaiguailang/harmony/service/SystemService.java b/src/main/java/com/guaiguailang/harmony/service/SystemService.java index e202b57..87e0363 100644 --- a/src/main/java/com/guaiguailang/harmony/service/SystemService.java +++ b/src/main/java/com/guaiguailang/harmony/service/SystemService.java @@ -9,4 +9,6 @@ public interface SystemService { ResponseResult getMenuAll(); ResponseResult updateMenu(MenuDataItem menuDataItem); + + ResponseResult addMenu(MenuDataItem menuDataItem); } diff --git a/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java b/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java index aade168..3ca885d 100644 --- a/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java +++ b/src/main/java/com/guaiguailang/harmony/service/impl/SystemServiceImpl.java @@ -62,4 +62,19 @@ public class SystemServiceImpl implements SystemService { } + @Override + public ResponseResult addMenu(MenuDataItem menuDataItem) { + try{ + int success = systemMapper.insert(menuDataItem); + if (success==1) { + return ResponseResult.success("菜单新增成功"); + } else { + return ResponseResult.info(0,"菜单新增失败"); + } + }catch (Exception e) { + log.error(e.getMessage()); + return ResponseResult.error(e.getMessage()); + } + } + }