@Action(value = "menuTreeList", results = @Result(name = "menutree", location="/WEB-INF/pages/base/right.jsp"))
public String menuTreeList()
{
HttpServletRequest request = ServletActionContext.getRequest();
//获取角色ID
String RoleId=request.getParameter("roleid");
//保存
ActionContext actionContext = ActionContext.getContext();
Map session = actionContext.getSession();
//保存角色
session.put("RoleId", RoleId);
//查询多个表----------------------------------------
//根据角色ID查询选中的权限---菜单
menuselect=rightService.getMenusTreeSelect(RoleId);;
for(MenusInfo a:menuselect)
{
String getid=a.getId().toString();
menumap.put(getid,getid);
}
//根据角色ID查询选中的权限---功能
resourceselect=rightService.getResourcesTreeSelect(RoleId);
for(MenuResourcesInfo a:resourceselect)
{
String getid=a.getId();
Resourcesmap.put(getid,getid);
}
//根据角色ID查询选中的权限---数据列
//-----------------------------------------------------------------------
if(RoleId!=null)
{
//查询菜单模块列表
getMenusInfoTree();
for(MenusInfo m:milist)
{
String name=m.getCname();//取数据
String pid=m.getPid();
String id=m.getId();
String treeid=m.getTreeid();
String[] a=treeid.split("-");
int len=a.length;
//比较是否为选中数据
if(null==menumap.get(id))
{
//未选中
String[] ary1 = new String[]{id,pid,name,"false","0"}; //每行数据
tree.add(ary1);
}
else
{
//选中
String[] ary1 = new String[]{id,pid,name,"true","0"}; //每行数据
tree.add(ary1);
}
}
getMenuResources();//查询功能菜单
for(MenuResourcesInfo mri:mrilist)
{
String name=mri.getRescoresname();
String id=mri.getId();
String pid=mri.getMid();
//比较是否为选中数据
if(null==Resourcesmap.get(id))
{
String[] ary2 = new String[]{id,pid,name,"false","1"}; //每行数据
tree.add(ary2);
}
else
{
String[] ary2 = new String[]{id,pid,name,"true","1"}; //每行数据
tree.add(ary2);
}
}
}
return "menutree";
}
金山词霸下载地址