public String reportDayList() {
    StringBuffer s = new StringBuffer();
    User current_user = (User) session.getAttribute(SessionConstant.CURRENT_USER);
    if (current_user.getBusinessids() != null) {
      if (current_user.getBusinessids() != "-1") {
        String[] bids = current_user.getBusinessids().split(",");
        if (bids.length > 0) {
          for (int ii = 0; ii < bids.length; ii++) {
            if (bids[ii].trim().length() > 0) {
              s.append(" bid like '%").append(bids[ii]).append("%' ");
              if (ii != bids.length - 1) s.append(" or ");
            }
          }
        }
      }
    }
    // InterfaceTempDao interfaceDao = new InterfaceTempDao();
    List list = new ArrayList();
    HostNodeDao dao = new HostNodeDao();
    list = dao.loadNetworkByBid(4, current_user.getBusinessids());

    List interfaceList = new ArrayList();
    PortconfigDao portconfigDao = new PortconfigDao();
    try {
      interfaceList = portconfigDao.getAllBySms();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      portconfigDao.close();
    }

    request.setAttribute("list", list);
    request.setAttribute("interfaceList", interfaceList);
    return "/capreport/comprehensive/compreReportDay.jsp";
  }
示例#2
0
  /**
   * 获得业务权限的 SQL 语句
   *
   * @author nielin
   * @date 2010-08-09
   * @return
   */
  public String getBidSql(String fieldName) {
    User current_user = (User) session.getAttribute(SessionConstant.CURRENT_USER);

    String sql = "";
    StringBuffer s = new StringBuffer();
    if (current_user.getRole() != 0) {
      int _flag = 0;
      if (current_user.getBusinessids() != null) {
        if (current_user.getBusinessids() != "-1") {
          String[] bids = current_user.getBusinessids().split(",");
          if (bids.length > 0) {
            for (int i = 0; i < bids.length; i++) {
              if (bids[i].trim().length() > 0) {
                if (_flag == 0) {
                  s.append(" and ( " + fieldName + " like '%," + bids[i].trim() + ",%' ");
                  _flag = 1;
                } else {
                  // flag = 1;
                  s.append(" or " + fieldName + " like '%," + bids[i].trim() + ",%' ");
                }
              }
            }
            s.append(") ");
          }
        }
      }
    }

    sql = s.toString();

    String treeBid = request.getParameter("treeBid");
    if (treeBid != null && treeBid.trim().length() > 0) {
      treeBid = treeBid.trim();
      treeBid = "," + treeBid + ",";
      String[] treeBids = treeBid.split(",");
      if (treeBids != null) {
        for (int i = 0; i < treeBids.length; i++) {
          if (treeBids[i].trim().length() > 0) {
            sql = sql + " and " + fieldName + " like '%," + treeBids[i].trim() + ",%'";
          }
        }
      }
    }
    // SysLogger.info("select * from topo_host_node where managed=1 "+sql);
    return sql;
  }