在请求菜单页面时,会弹出一个请求不到菜单接口,当时的代码是:
@RequestMapping(value = "get/tree",method = {RequestMethod.GET,RequestMethod.POST})
@ApiOperation(tags = "菜单管理左侧菜单树链接",value = "获取菜单树")
public DtreeResult getTree(){
DtreeResult result = new DtreeResult();
// 同dtree中status一样设置
// -------------此处出错-------------------------------------
HashMap<Object, Object> map = new HashMap<>();
map.put("code",200);
map.put("message","操作成功");
result.setStatus(map);
// 同dtree中data一样设置
List<TreeNode> nodeList=menuService.getTreeNode();
result.setData(nodeList);
return result;
}
之后看了一下代码,发现map返回的是一个map集合,并且里面的参数有误,应该改成:
Map<String,Object> map=new HashMap<>();
完整代码:
@RequestMapping(value = "get/tree",method = {RequestMethod.GET,RequestMethod.POST})
@ApiOperation(tags = "菜单管理左侧菜单树链接",value = "获取菜单树")
public DtreeResult getTree(){
DtreeResult result = new DtreeResult();
// 同dtree中status一样设置
Map<String,Object> map=new HashMap<>();
map.put("code",200);
map.put("message","操作成功");
result.setStatus(map);
// 同dtree中data一样设置
List<TreeNode> nodeList=menuService.getTreeNode();
result.setData(nodeList);
return result;
}