Esempio n. 1
0
  /**
   * @author upshi
   * @date 20160219
   * @url /rest/appRole/search/appName/{appName}
   */
  @ResponseBody
  @RequestMapping(value = "/search/appName/{appName}", method = RequestMethod.GET)
  public Map<String, Object> search(@PathVariable String appName) {
    Map<String, Object> map = new HashMap<String, Object>();
    List<AppRole> appRoles = null;
    try {
      appRoles =
          appRoleService.getRolesByAppName(new String(appName.getBytes("ISO-8859-1"), "UTF-8"));
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      map.put("status", "参数转码错误!");
    }

    if (appRoles != null && appRoles.size() != 0) {
      map.put("code", "8000");
      map.put("result", "success");
      map.put("appRoles", appRoles);
    } else {
      map.put("code", "5002");
      map.put("result", "failure");
      map.put("reason", "您查询的应用下没有角色");
    }
    return map;
  }
Esempio n. 2
0
  /**
   * @author ishadow
   * @date 20160820 旧版查找
   * @url /rest/appRole/appName/{appName}
   */
  @ResponseBody
  @RequestMapping(value = "/appName/{appName}", method = RequestMethod.GET)
  public Map<String, Object> oldSearch(@PathVariable String appName) {
    Map<String, Object> map = new HashMap<String, Object>();
    List<AppRole> appRoles = null;
    appRoles = appRoleService.getRolesByAppName(appName);

    if (appRoles != null && appRoles.size() != 0) {
      map.put("code", "8000");
      map.put("result", "success");
      map.put("appRoles", appRoles);
    } else {
      map.put("code", "5002");
      map.put("result", "failure");
      map.put("reason", "您查询的应用下没有角色");
    }
    return map;
  }