⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reportdaoimpl.java

📁 一套完整的工商12315的源程序jsp部分在12315里,后台JAVA部分在gs12315src里,没有打包数据库.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
           String rowcolendpoint;
       */

      sql = "select * from  "
          + TableNameUtil.UNIVERSAL_REPORT_DATA
          + " where ";
      if (reportPageDataModel.getCode() != null) {
        sql = sql + " code='" + reportPageDataModel.getCode() + "' and ";

      }
      if (reportPageDataModel.getReportCode() != null) {
        sql = sql + " report_code='" + reportPageDataModel.getReportCode() +
            "' and ";

      }
      if (reportPageDataModel.getPageCode() != null) {
        sql = sql + " pageCode ='" + reportPageDataModel.getPageCode() +
            "' and ";

//                if(reportPageDataModel.getContent()!=null)
//                    sql=sql+" content like'"+reportPageDataModel.getContent()+"' and ";

      }
      if (reportPageDataModel.getTableRow() != null) {
        sql = sql + " row ='" + reportPageDataModel.getTableRow() + "' and ";

      }
      if (reportPageDataModel.getTableCol() != null) {
        sql = sql + " col ='" + reportPageDataModel.getTableCol() + "' and ";

      }
      if (reportPageDataModel.getRowColEndPoint() != null) {
        sql = sql + " rowColEndPoint ='" +
            reportPageDataModel.getRowColEndPoint() + "' and ";

      }
      sql += " 1=1  order by code desc"; //补丁

      Debug.println("[ReportDAOImpl]getReportBuildData--->>>sql:" + sql);
      rs = stmt.executeQuery(sql);
   //   conn.commit();
      /*
           String code;
           String reportCode;
           String pageCode;
           String content;
           String table_row;
           String table_col;
           String rowcolendpoint;
       */
      while (rs.next()) {
        reportPageDataModelTemp = new ReportPageDataModel();
        reportPageDataModelTemp.setCode(PubFunc.decodeGB(rs.getString("code")));
        reportPageDataModelTemp.setReportCode(PubFunc.decodeGB(rs.getString(
            "report_code")));
        reportPageDataModelTemp.setPageCode(PubFunc.decodeGB(rs.getString(
            "page_code")));
        reportPageDataModelTemp.setContent(PubFunc.decodeGB(rs.getString(
            "content")));
        reportPageDataModelTemp.setTableRow(PubFunc.decodeGB(rs.getString(
            "table_row")));
        reportPageDataModelTemp.setTableCol(PubFunc.decodeGB(rs.getString(
            "table_col")));
        reportPageDataModelTemp.setRowColEndPoint(PubFunc.decodeGB(rs.getString(
            "rowcolendpoint")));
        reportPageDataList.add(reportPageDataModelTemp);
      }
    }
    catch (SQLException sqle) {
      Debug.println("[ReportDAOImpl]getReportBuildData--->>>Exception:" +
                    sqle.getMessage());
    }

    finally {
      try {
        this.closePreparedStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeResultSet();
      }
      catch (Exception e) {
      }
      try {
        this.closeStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeConnection();
      }
      catch (Exception e) {
      }
    }
    Debug.println(
        "[ReportDAOImpl]getReportBuildData--->>>reportPageList.size():" +
        reportPageDataList.size());
    return reportPageDataList;
  }

  /**
   * 添加报表数据
   *应用:添加报表数据[UNIVERSAL_REPORT_DATA]
   */
  public boolean addReportBuildData(ReportPageDataModel reportPageDataModel) throws
      AppException {
    boolean flag = false;
    String sql = null;
    try {
      String code = "";
      //得到code
      code = getTableSN(TableNameUtil.UNIVERSAL_REPORT_DATA, "code");
      Debug.println("code:" + code);

      conn = Common.getConnection();
      //conn.setAutoCommit(false);
      stmt = conn.createStatement();

      //是否正常数据
      if (reportPageDataModel == null) {
        Debug.println(
            "[ReportDAOImpl]addReportBuildData----->reportPageDataModel is null!");
        return flag;
      }

      /*
           String code;
           String reportCode;
           String pageCode;
           String content;
           String table_row;
           String table_col;
           String rowcolendpoint;
       */

      sql = "insert into "
          + TableNameUtil.UNIVERSAL_REPORT_DATA
          +
          " (code,report_code,page_code,content,table_row,table_col,rowcolendpoint)values('"
          + PubFunc.toSql(reportPageDataModel.getCode(), 0)
          + "','"
          + PubFunc.toSql(reportPageDataModel.getReportCode(), 0)
          + "','"
          + PubFunc.toSql(reportPageDataModel.getPageCode(), 0)
          + "','"
          + PubFunc.toSql(reportPageDataModel.getContent(), 0)
          + "','"
          + PubFunc.toSql(reportPageDataModel.getTableRow(), 0)
          + "','"
          + PubFunc.toSql(reportPageDataModel.getTableCol(), 0)
          + "','"
          + PubFunc.toSql(reportPageDataModel.getRowColEndPoint(), 0)
          + "')"
          ;

      Debug.println("[ReportDAOImpl]addReportBuildData--->>>sql:" + sql);

      stmt.executeUpdate(sql);
    //  conn.commit();
      flag = true;
    }
    catch (SQLException sqle) {
      Debug.println("[ReportDAOImpl]addReportBuildData--->>>Exception:" +
                    sqle.getMessage());
    }

    finally {
      try {
        this.closePreparedStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeResultSet();
      }
      catch (Exception e) {
      }
      try {
        this.closeStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeConnection();
      }
      catch (Exception e) {
      }
    }

    return flag;
  }

  /**
   * 添加报表数据
   *应用:添加报表数据[UNIVERSAL_REPORT_DATA]
   */
  public boolean addReportBuildData(ArrayList reportPageDataList,
                                    String report_code) throws
      AppException {
    boolean flag = false;
    String sql = null;
    long tempLong = 0;
    ReportPageDataModel reportPageDataModel = null;
    try {
      String code = "";
      //得到code
      code = getTableSN(TableNameUtil.UNIVERSAL_REPORT_DATA, "code");
      Debug.println("code:" + code);

      conn = Common.getConnection();
      //conn.setAutoCommit(false);
      stmt = conn.createStatement();

      //是否正常数据
      if (reportPageDataList.size() == 0) {
        Debug.println(
            "[ReportDAOImpl]addReportBuildData----->reportPageDataList 'size is 0!");
        return flag;
      }

      /*
           String code;
           String reportCode;
           String pageCode;
           String content;
           String table_row;
           String table_col;
           String rowcolendpoint;
       */

      for (int i = 0; i < reportPageDataList.size(); i++) {
        reportPageDataModel = (ReportPageDataModel) reportPageDataList.
            get(i);
        sql = "insert into "
            + TableNameUtil.UNIVERSAL_REPORT_DATA
            +
            " (code,report_code,page_code,content,table_row,table_col,rowcolendpoint)values('"
            + code
            + "','"
            + report_code
            + "','"
            + PubFunc.toSql(reportPageDataModel.getPageCode(), 0)
            + "','"
            + PubFunc.toSql(reportPageDataModel.getContent(), 0)
            + "','"
            + PubFunc.toSql(reportPageDataModel.getTableRow(), 0)
            + "','"
            + PubFunc.toSql(reportPageDataModel.getTableCol(), 0)
            + "','"
            + PubFunc.toSql(reportPageDataModel.getRowColEndPoint(), 0)
            + "')"
            ;

        Debug.println("[ReportDAOImpl]addReportBuildData--->>>sql:" +
                      sql);
        stmt.executeUpdate(sql);

        //计算下一个code
        tempLong = Long.parseLong(code) + 1;
        code = "" + tempLong;
        Debug.println("[ReportDAOImpl]addReportBuildData--->>>code:" +
                      code);
      }
    //  conn.commit();
      flag = true;
    }
    catch (SQLException sqle) {
      Debug.println("[ReportDAOImpl]addReportBuildData--->>>Exception:" +
                    sqle.getMessage());
    }

    finally {
      try {
        this.closePreparedStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeResultSet();
      }
      catch (Exception e) {
      }
      try {
        this.closeStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeConnection();
      }
      catch (Exception e) {
      }
    }

    return flag;
  }

  /**
   * 修改报表数据
   *应用:修改报表数据[UNIVERSAL_REPORT_DATA]
   */
  public boolean editeReportBuildData(ReportPageDataModel reportPageDataModel) throws
      AppException {
    boolean flag = false;
    String sql = null;
    try {
      conn = Common.getConnection();
      //conn.setAutoCommit(false);
      stmt = conn.createStatement();

      //是否正常数据
      if (reportPageDataModel == null) {
        Debug.println(
            "[ReportDAOImpl]editeReportBuildData----->reportPageDataModel is null!");
        return flag;
      }

      /*
       code
       page_code
       content 内容
       */

      sql = "update "
          + TableNameUtil.UNIVERSAL_REPORT_DATA
          + " set content='"
          + PubFunc.toSql(reportPageDataModel.getContent(), 0)
          + "' where code='"
          + PubFunc.toSql(reportPageDataModel.getCode(), 0)
          + "'"
          ;
      Debug.println("[ReportDAOImpl]editeReportBuildData--->>>sql:" + sql);

      stmt.executeUpdate(sql);
     // conn.commit();
      flag = true;
    }
    catch (SQLException sqle) {
      Debug.println("[ReportDAOImpl]editeReportBuildData--->>>Exception:" +
                    sqle.getMessage());
    }

    finally {
      try {
        this.closePreparedStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeResultSet();
      }
      catch (Exception e) {
      }
      try {
        this.closeStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeConnection();
      }
      catch (Exception e) {
      }
    }

    return flag;
  }

  /**
   * 删除报表数据 code 单条记录
   *应用:删除报表数据[UNIVERSAL_REPORT_DATA]
   */
  public boolean dellReportBuildDataCode(String code) throws
      AppException {
    boolean flag = false;
    String sql = null;
    try {
      conn = Common.getConnection();
     // conn.setAutoCommit(false);
      stmt = conn.createStatement();

      //是否正常数据
      if (code == null || "".equals(code)) {
        Debug.println(
            "[ReportDAOImpl]dellReportBuildDataCode----->code is null!");
        return flag;
      }

      /*
       code
       page_code
       content 内容
       */

      sql = "delete from  "
          + TableNameUtil.UNIVERSAL_REPORT_DATA
          + " where code='"
          + PubFunc.toSql(code, 0)
          + "'"
          ;

      Debug.println("[ReportDAOImpl]dellReportBuildDataCode--->>>sql:" +
                    sql);

      stmt.executeUpdate(sql);
   //   conn.commit();
      flag = true;
    }
    catch (SQLException sqle) {
      Debug.println(
          "[ReportDAOImpl]dellReportBuildDataCode--->>>Exception:" +
          sqle.getMessage());
    }

    finally {
      try {
        this.closePreparedStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeResultSet();
      }
      catch (Exception e) {
      }
      try {
        this.closeStatement();
      }
      catch (Exception e) {
      }
      try {
        this.closeConnection();
      }
      catch (Exception e) {
      }
    }

    return flag;
  }

  /**
   * 删除报表数据
   *应用:删除报表数据[UNIVERSAL_REPORT_DATA]
   */
  public boolean dellReportBuildDataPage(String page_code) throws
      AppException {
    boolean flag = false;
    String sql = null;
    try {
      conn = Common.getConnection();
   //   conn.setAutoCommit(false);
      stmt = conn.createStatement();

      //是否正常数据
      if (page_code == null || "".equals(page_code)) {
        Debug.println(
            "[ReportDAOImpl]dellReportBuildDataPage----->page_code is null!");
        return flag;
      }

      /*
       code
       page_code
       content 内容
       */

      sql = "delete from  "
          + TableNameUtil.UNIVERSAL_REPORT_DATA
          + " where page_code='"
          + PubFunc.toSql(page_code, 0)
          + "'"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -