示例#1
0
  /**
   * 删除角色
   *
   * @param response
   * @param ids
   */
  @RequestMapping(value = "ajaxDeleteRole", method = RequestMethod.POST)
  public void ajaxDeleteRole(HttpServletResponse response, String ids) {
    ResponseMap responseMap = new HashResponseMap();
    try {
      this.roleService.deleteRole(ids);
      responseMap.setStatus(true);
      responseMap.setInfo("删除角色成功");
    } catch (ServiceException e) {
      responseMap.setStatus(false);
      responseMap.setInfo(e.getMessage());
    }

    WebUtil.writerJson(response, responseMap);
  }
示例#2
0
  /**
   * 分配角色权限
   *
   * @param response
   * @param roleId
   * @param privilegeIds
   */
  @RequestMapping(value = "ajaxAllotRolePrivilege", method = RequestMethod.POST)
  public void ajaxAllotRolePrivilege(
      HttpServletResponse response, Integer roleId, String privilegeIds) {
    ResponseMap responseMap = new HashResponseMap();
    try {
      this.roleService.allotRolePrivilege(roleId, privilegeIds);
      responseMap.setStatus(true);
      responseMap.setInfo("分配权限成功");
    } catch (ServiceException e) {
      responseMap.setStatus(false);
      responseMap.setInfo(e.getMessage());
    }

    WebUtil.writerJson(response, responseMap);
  }
示例#3
0
  /**
   * 添加角色
   *
   * @param response
   * @param request
   * @param role
   */
  @RequestMapping(value = "ajaxAddRole", method = RequestMethod.POST)
  public void ajaxAddRole(HttpServletResponse response, HttpServletRequest request, Role role) {
    ResponseMap responseMap = new HashResponseMap();
    try {
      this.roleService.addRole(role);
      responseMap.put("id", role.getId());
      responseMap.setStatus(true);
      responseMap.setInfo("添加角色成功");
    } catch (ServiceException e) {
      responseMap.setStatus(false);
      responseMap.setInfo(e.getMessage());
    }

    WebUtil.writerJson(response, responseMap);
  }
示例#4
0
  /**
   * 异步表单角色名称验证(新增和修改)
   *
   * @param response
   * @param param
   * @param name
   */
  @RequestMapping("ajaxFormRoleName")
  public void ajaxFormRoleName(
      HttpServletResponse response, String param, String name, Integer id) {
    ResponseMap responseMap = new HashResponseMap();
    try {
      if (null != id) {
        this.roleService.checkUpdateRoleName(id, param);
      } else {
        this.roleService.checkRoleName(param);
      }
      responseMap.setStatus(true);
      responseMap.setInfo("该角色名称可用");
    } catch (ServiceException e) {
      responseMap.setStatus(false);
      responseMap.setInfo(e.getMessage());
    }

    WebUtil.writerJson(response, responseMap);
  }