/**
   * 通过对象查询数量
   *
   * @param role
   * @param response
   */
  @RequestMapping(
      value = "/queryCountByObj",
      method = {RequestMethod.POST, RequestMethod.GET})
  public void queryCountByObj(Resource res, HttpServletResponse response) {
    int infoMsg = 0;
    try {
      List<Resource> list = resourceService.queryResourceByObj(res);
      if (list.size() > 0) { // 加入只有一条的话,则为本身。
        infoMsg = list.size();
      }
    } catch (Exception e) {
      log.error("queryCountByObj error通过对象查询数量出错");
    }

    response.setContentType("text/html;charset=utf-8");
    PrintWriter pw = null;
    try {
      pw = response.getWriter();
      pw.write(infoMsg + "");
      pw.flush();
    } catch (IOException e) {
      log.error("pw.write(jsonData.toString())  error");
    } finally {
      if (pw != null) {
        pw.close();
      }
    }
  }