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()); + } + } + }