|
本帖最后由 小号工作 于 2013-4-9 16:55 编辑
1.菜单录入页面
WebRoot\webpage\system\function\function.jsp
菜单等级select下拉处增加一条:
<option value="100" <c:if test="${function.functionLevel eq 100}">selected="selected"</c:if>>操作按钮</option>
value="100"这个随便设置,意思是按钮都是这个数字的
2.java部分
src\jeecg\system\controller\core\UserController.java
修改
@RequestMapping(params = "user")
public String user(HttpServletRequest request) { 这个方法如下:
/**
* 用户列表页面跳转
*
* @return
*/
@RequestMapping(params = "user")
public String user(HttpServletRequest request) {
HttpSession session = ContextHolderUtils.getSession();
SessionInfo sessionInfo = (SessionInfo) session.getAttribute(Globals.USER_SESSION);
CriteriaQuery cq = new CriteriaQuery(TSUserFunctionView.class);
cq.eq("userId", sessionInfo.getUser().getId());
cq.eq("functionLevel", Short.parseShort("100"));//100表示按钮(所有按钮都一样)
cq.add();
List<TSUserFunctionView> buttonList = systemService.getListByCriteriaQuery(cq, false);
List<String> btnNameList = new ArrayList<String>();
if(buttonList != null && buttonList.size() > 0) {
for (TSUserFunctionView userFunBtn : buttonList) {
btnNameList.add(userFunBtn.getFunctionName());
}
}
request.setAttribute("btnNameList", btnNameList);
////////////////////////////////////////////////////// 华丽的分割线 ////////////////////////////////////////////////////////////////
return "system/user/userList";
}
3.增加数据库视图:
select uuid() AS `id`,`u`.`id` AS `userId`,`f`.`functionname` AS `functionname`,`f`.`functionlevel` AS `functionlevel`,`f`.`functionurl` AS `functionurl` from (((`t_s_user` `u` left join `t_s_role_user` `ru` on((`u`.`id` = `ru`.`userid`))) left join `t_s_role_function` `rf` on((`ru`.`roleid` = `rf`.`roleid`))) left join `t_s_function` `f` on((`rf`.`functionid` = `f`.`id`)))
4.添加视图entity类到src\jeecg\system\pojo\base目录下
TSUserFunctionView.zip
(632 Bytes, 下载次数: 30)
5.页面按钮权限控制:
WebRoot\webpage\system\user\userList.jsp
userList.zip
(941 Bytes, 下载次数: 31)
6.到菜单模块,增加菜单如图,但后绑定到用户角色,刷新就ok啦
|
|