class MenuService {

    public List<MenuTreeDto> getUserMenu(String uuid){
        Assert.notNull(uuid,"uuid is not null");

        // 判断是否是超级管理员
        List<SysRole> roles = roleService.selectByUuid(uuid);
        boolean isAdmin = roles.stream().anyMatch(role -> "ROLE_ADMIN".equals(role.getRoleKey()));
        if(isAdmin) {
            return getMenuTreeEnabled();
        }

        List<SysPermission> permissions = permissionService.selectByUuidAndType(uuid, TYPE_MENU);
        List<Menu> collect = permissions.stream().map(this::toMenu).collect(Collectors.toList());
        return buildMenuTree(collect,-1);
    }

}

class MenuServiceTest  {

    @Autowired
    private MenuService menuService;
    @Autowired
    private UserService userService;

    @Test
    public void getUserMenu() {


        SysUser admin = userService.findByUsername("admin");
        String uuid = admin.getUuid();

        List<MenuTreeDto> menus = menuService.getUserMenu(uuid);
        System.out.println(menus);

    }

}