feat: 菜单新增接口完成

This commit is contained in:
萌狼蓝天 2024-11-04 17:09:58 +08:00
parent 8cba4462c8
commit 92b01751bf
3 changed files with 21 additions and 0 deletions

View File

@ -38,5 +38,9 @@ public class SystemController {
public ResponseEntity updateMenu(@RequestBody MenuDataItem menuDataItem) { public ResponseEntity updateMenu(@RequestBody MenuDataItem menuDataItem) {
return ResponseEntity.ok(systemService.updateMenu(menuDataItem)); return ResponseEntity.ok(systemService.updateMenu(menuDataItem));
} }
@PostMapping("/menu-add")
public ResponseEntity addMenu(@RequestBody MenuDataItem menuDataItem) {
return ResponseEntity.ok(systemService.addMenu(menuDataItem));
}
} }

View File

@ -9,4 +9,6 @@ public interface SystemService {
ResponseResult getMenuAll(); ResponseResult getMenuAll();
ResponseResult updateMenu(MenuDataItem menuDataItem); ResponseResult updateMenu(MenuDataItem menuDataItem);
ResponseResult addMenu(MenuDataItem menuDataItem);
} }

View File

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