Ejemplo n.º 1
0
 /**
  * 修改权限
  *
  * @return 跳转成功
  */
 public String modify() {
   entityId = (String) session.get("rightId");
   // 修改基本信息
   Right mright = (Right) rolerightservice.query(Right.class, entityId);
   if (mright == null) {
     request.setAttribute("tip", "不存在的权限");
     return INPUT;
   }
   if (!mright.getName().equals(right.getName())) {
     // 检查权限名称是否存在
     if (rolerightservice.checkRightName(right.getName())) {
       request.setAttribute("tip", "该权限名已存在");
       return INPUT;
     }
   }
   if (!mright.getCode().equals(right.getCode())) {
     // 检查权限代码是否存在
     if (rolerightservice.checkRightCode(right.getCode())) {
       request.setAttribute("tip", "改权限代码已存在");
       return INPUT;
     }
   }
   mright.setName(right.getName());
   mright.setDescription(right.getDescription());
   rolerightservice.modifyRight(mright, actionUrlArray, actionDesArray);
   List<Object> rightUrl =
       baseService.query(
           "select right0.name, right_action.actionurl from Right right0, RightUrl right_action where right0.id = right_action.right.id order by right_action.actionurl asc");
   request.getSession().getServletContext().setAttribute("rightUrl", rightUrl);
   return SUCCESS;
 }
Ejemplo n.º 2
0
 /**
  * 进入修改权限
  *
  * @return 跳转成功
  */
 public String toModify() {
   session.put("rightId", entityId);
   // 获取权限基本信息
   right = (Right) rolerightservice.query(Right.class, entityId);
   if (right == null) {
     request.setAttribute("errorInfo", "不存在的权限");
     return INPUT;
   }
   // 获取权限action信息
   StringBuffer hql = new StringBuffer();
   Map map = new HashMap();
   hql.append(
       "from RightUrl right_action where right_action.right.id = :rightId order by right_action.actionurl");
   map.put("rightId", entityId);
   pageList = rolerightservice.query(hql.toString(), map);
   return SUCCESS;
 }
Ejemplo n.º 3
0
 /**
  * 添加权限
  *
  * @return 跳转成功
  */
 public String add() {
   // 检查权限名称是否存在
   if (rolerightservice.checkRightName(right.getName())) {
     request.setAttribute("errorInfo", "该权限名已存在");
     return INPUT;
   }
   if (rolerightservice.checkRightCode(right.getCode())) {
     request.setAttribute("errorInfo", "改权限代码已存在");
     return INPUT;
   }
   entityId = rolerightservice.addRight(right, actionUrlArray, actionDesArray);
   List<Object> rightUrl =
       baseService.query(
           "select right0.name, right_action.actionurl from Right right0, RightUrl right_action where right0.id = right_action.right.id order by right_action.actionurl asc");
   request.getSession().getServletContext().setAttribute("rightUrl", rightUrl);
   return SUCCESS;
 }
Ejemplo n.º 4
0
 /**
  * 删除权限
  *
  * @return 跳转成功
  */
 public String delete() {
   try {
     rolerightservice.deleteRight(entityIds);
     return SUCCESS;
   } catch (Exception e) {
     jsonMap.put(GlobalInfo.ERROR_INFO, "有权限不存在");
     return INPUT;
   }
 }
Ejemplo n.º 5
0
 /**
  * 查看权限
  *
  * @return 跳转成功
  */
 public String view() {
   // 获取角色基本信息
   right = (Right) rolerightservice.query(Right.class, entityId);
   if (right == null) {
     this.addFieldError(GlobalInfo.ERROR_INFO, "不存在的权限");
     jsonMap.put(GlobalInfo.ERROR_INFO, "不存在的权限");
     return INPUT;
   }
   // 获取角色的权限信息
   StringBuffer hql = new StringBuffer();
   Map map = new HashMap();
   hql.append(
       "from RightUrl right_action where right_action.right.id = :rightId order by right_action.actionurl asc");
   map.put("rightId", entityId);
   pageList = rolerightservice.query(hql.toString(), map);
   jsonMap.put("right", right);
   jsonMap.put("pageList", pageList);
   return SUCCESS;
 }