@Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
  @Path("/add")
  @POST
  public String add(
      @FormParam("name") String name,
      @FormParam("description") String description,
      @FormParam("status") String status,
      @FormParam("resource") String resource) {
    /*if(name==null || name.trim().equals("") || description==null || description.trim().equals("") || status==null || status.trim().equals("")){
        return JsonResultUtils.getCodeAndMesByString(JsonResultUtils.Code.ERROR.getCode(), "参数不能为空!");
    }*/
    long existAuthorityId;
    try {
      existAuthorityId = authorityService.getIdByName(name);

    } catch (Exception ex) {
      existAuthorityId = 0;
    }
    if (existAuthorityId == 0) {
      Authority authority = new Authority();
      authority.setName(name);
      authority.setDescription(description);
      authority.setStatus(Integer.parseInt(status));
      authorityService.add(authority);
      long currentAuthorityId = authorityService.getIdByName(name);
      String[] resourceArray = resource.split(";");
      for (int i = 0; i < resourceArray.length; i++) {
        long powerId = powerService.getIdByResource(resourceArray[i]);
        AuthorityPower authorityPower = new AuthorityPower();
        authorityPower.setAuthorityId(currentAuthorityId);
        authorityPower.setPowerId(powerId);
        authorityPower.setPowerResource(resourceArray[i]);
        authorityPower.setAuthorityName(name);
        authorityPowerService.add(authorityPower);
      }
      return JsonResultUtils.getCodeAndMesByStringAsDefault(JsonResultUtils.Code.SUCCESS);
    } else {
      return JsonResultUtils.getObjectResultByStringAsDefault("fail", JsonResultUtils.Code.ERROR);
    }
  }