| | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.MenuParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.MenuService; |
| | | import com.sandu.ximon.dao.bo.MenuNode; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RequestMapping("/admin/menu") |
| | | public class MenuController { |
| | | |
| | | private PermissionConfig permissionConfig; |
| | | |
| | | private final MenuService menuService; |
| | | |
| | | // @GetMapping("treeMenuList") |
| | |
| | | |
| | | @GetMapping("/treeList") |
| | | public ResponseVO<Object> treeList() { |
| | | |
| | | if(!permissionConfig.check("菜单列表")){ |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<MenuNode> menuTrees = menuService.treeList(); |
| | | return ResponseUtil.success(menuTrees); |
| | | } |
| | |
| | | |
| | | boolean result = menuService.updateMenu(menuId,param); |
| | | if (result) { |
| | | return ResponseUtil.success("添加成功"); |
| | | return ResponseUtil.success("编辑成功"); |
| | | } else { |
| | | return ResponseUtil.fail("添加失败"); |
| | | return ResponseUtil.fail("编辑失败"); |
| | | } |
| | | } |
| | | |
| | | @PostMapping |
| | | @PostMapping("/del/{menuId}") |
| | | public ResponseVO<Object> delMenu(@PathVariable Long menuId) { |
| | | |
| | | boolean result = menuService.delMenu(menuId); |
| | | if (result) { |
| | | return ResponseUtil.success("删除成功"); |
| | | } else { |
| | | return ResponseUtil.fail("删除失败"); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addMenu(@Validated @RequestBody MenuParam param) { |
| | | |
| | | boolean result = menuService.addMenu(param); |