Пример #1
0
  /**
   * 查询角色列表
   *
   * @param response
   * @param pagination
   * @param role
   */
  @RequestMapping(value = "ajaxRoleList", method = RequestMethod.POST)
  public void ajaxRoleList(HttpServletResponse response, Pagination pagination, Role role) {
    pagination.getParamMap().put("role", role);

    this.roleService.pageQueryEntityList(pagination);
    WebUtil.writerPagination(response, pagination);
  }
Пример #2
0
  /**
   * 分页查询选择权限列表
   *
   * @param response
   * @param pagination
   * @param privilege
   */
  @RequestMapping(value = "ajaxSelectPrivilegeList", method = RequestMethod.POST)
  public void ajaxSelectPrivilegeList(
      HttpServletResponse response, Pagination pagination, Privilege privilege, Integer roleId) {
    pagination.setParamEntity(privilege);
    pagination.getParamMap().put("roleId", roleId);

    this.roleService.pageQuerySelectPrivilegeList(pagination);
    WebUtil.writerPagination(response, pagination);
  }
Пример #3
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);
  }
Пример #4
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);
  }
Пример #5
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);
  }
Пример #6
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);
  }