| | |
| | | List<SysMenu> menuList = sysMenuService.listMenuByUserId(userId); |
| | | return ResponseEntity.ok(MapUtil.builder().put("menuList", menuList).put("authorities", SecurityUtils.getSysUser().getAuthorities()).build()); |
| | | }catch (Exception e){ |
| | | throw new YamiShopBindException("系统错误!"); |
| | | throw new YamiShopBindException("System error!"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if(menu.getType() == MenuType.MENU.getValue()){ |
| | | if(StrUtil.isBlank(menu.getUrl())){ |
| | | throw new YamiShopBindException("菜单URL不能为空"); |
| | | throw new YamiShopBindException("Menu URL cannot be empty"); |
| | | } |
| | | } |
| | | if(Objects.equals(menu.getMenuId(), menu.getParentId())){ |
| | | throw new YamiShopBindException("自己不能是自己的上级"); |
| | | throw new YamiShopBindException("Cannot set yourself as parent"); |
| | | } |
| | | |
| | | //上级菜单类型 |
| | |
| | | if(menu.getType() == MenuType.CATALOG.getValue() || |
| | | menu.getType() == MenuType.MENU.getValue()){ |
| | | if(parentType != MenuType.CATALOG.getValue()){ |
| | | throw new YamiShopBindException("上级菜单只能为目录类型"); |
| | | throw new YamiShopBindException("Parent menu must be a directory"); |
| | | } |
| | | return ; |
| | | } |
| | |
| | | //按钮 |
| | | if(menu.getType() == MenuType.BUTTON.getValue()){ |
| | | if(parentType != MenuType.MENU.getValue()){ |
| | | throw new YamiShopBindException("上级菜单只能为菜单类型"); |
| | | throw new YamiShopBindException("Parent menu must be a menu type"); |
| | | } |
| | | } |
| | | } |