/**
   * 使用 ResultSet 中的第 i 行给 Schema 赋值
   *
   * @param: rs ResultSet
   * @param: i int
   * @return: boolean
   */
  public boolean setSchema(ResultSet rs, int i) {
    try {
      // rs.absolute(i);		// 非滚动游标
      if (rs.getString("RiskCode") == null) this.riskCode = null;
      else this.riskCode = rs.getString("RiskCode").trim();

      if (rs.getString("RiskVer") == null) this.riskVer = null;
      else this.riskVer = rs.getString("RiskVer").trim();

      if (rs.getString("DutyCode") == null) this.dutyCode = null;
      else this.dutyCode = rs.getString("DutyCode").trim();

      if (rs.getString("ChoFlag") == null) this.choFlag = null;
      else this.choFlag = rs.getString("ChoFlag").trim();

      if (rs.getString("SpecFlag") == null) this.specFlag = null;
      else this.specFlag = rs.getString("SpecFlag").trim();

    } catch (SQLException sqle) {
      System.out.println(
          "数据库中的LEPRiskDuty表字段个数和Schema中的字段个数不一致,或者执行db.executeQuery查询时没有使用select * from tables");
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEPRiskDutySchema";
      tError.functionName = "setSchema";
      tError.errorMessage = sqle.toString();
      this.mErrors.addOneError(tError);
      return false;
    }
    return true;
  }
  /**
   * 使用 ResultSet 中的第 i 行给 Schema 赋值
   *
   * @param: rs ResultSet
   * @param: i int
   * @return: boolean
   */
  public boolean setSchema(ResultSet rs, int i) {
    try {
      // rs.absolute(i);		// 非滚动游标
      if (rs.getString("CalCode") == null) this.calCode = null;
      else this.calCode = rs.getString("CalCode").trim();

      if (rs.getString("RiskCode") == null) this.riskCode = null;
      else this.riskCode = rs.getString("RiskCode").trim();

      if (rs.getString("Type") == null) this.type = null;
      else this.type = rs.getString("Type").trim();

      if (rs.getString("CalSQL") == null) this.calSQL = null;
      else this.calSQL = rs.getString("CalSQL").trim();

      if (rs.getString("Remark") == null) this.remark = null;
      else this.remark = rs.getString("Remark").trim();

    } catch (SQLException sqle) {
      System.out.println(
          "数据库中的LEPCalMode表字段个数和Schema中的字段个数不一致,或者执行db.executeQuery查询时没有使用select * from tables");
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEPCalModeSchema";
      tError.functionName = "setSchema";
      tError.errorMessage = sqle.toString();
      this.mErrors.addOneError(tError);
      return false;
    }
    return true;
  }
 /**
  * 获取定量数据
  *
  * @return LEDEPolicyMailInfoSet
  */
 public LEDEPolicyMailInfoSet getData() {
   int tCount = 0;
   LEDEPolicyMailInfoSet tLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();
   LEDEPolicyMailInfoSchema tLEDEPolicyMailInfoSchema = null;
   if (null == mResultSet) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "getData";
     tError.errorMessage = "数据集为空,请先准备数据集!";
     this.mErrors.addOneError(tError);
     return null;
   }
   try {
     tCount = 1;
     tLEDEPolicyMailInfoSchema = new LEDEPolicyMailInfoSchema();
     tLEDEPolicyMailInfoSchema.setSchema(mResultSet, 1);
     tLEDEPolicyMailInfoSet.add(tLEDEPolicyMailInfoSchema);
     // 注意mResultSet.next()的作用
     while (tCount++ < SysConst.FETCHCOUNT) {
       if (mResultSet.next()) {
         tLEDEPolicyMailInfoSchema = new LEDEPolicyMailInfoSchema();
         tLEDEPolicyMailInfoSchema.setSchema(mResultSet, 1);
         tLEDEPolicyMailInfoSet.add(tLEDEPolicyMailInfoSchema);
       }
     }
   } catch (Exception ex) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "getData";
     tError.errorMessage = ex.toString();
     this.mErrors.addOneError(tError);
     try {
       mResultSet.close();
       mResultSet = null;
     } catch (Exception ex2) {
     }
     try {
       mStatement.close();
       mStatement = null;
     } catch (Exception ex3) {
     }
     if (!mflag) {
       try {
         con.close();
       } catch (Exception et) {
       }
     }
     return null;
   }
   return tLEDEPolicyMailInfoSet;
 }
 /**
  * 获取数据集
  *
  * @return boolean
  */
 public boolean hasMoreData() {
   boolean flag = true;
   if (null == mResultSet) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "hasMoreData";
     tError.errorMessage = "数据集为空,请先准备数据集!";
     this.mErrors.addOneError(tError);
     return false;
   }
   try {
     flag = mResultSet.next();
   } catch (Exception ex) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "hasMoreData";
     tError.errorMessage = ex.toString();
     this.mErrors.addOneError(tError);
     try {
       mResultSet.close();
       mResultSet = null;
     } catch (Exception ex2) {
     }
     try {
       mStatement.close();
       mStatement = null;
     } catch (Exception ex3) {
     }
     if (!mflag) {
       try {
         con.close();
       } catch (Exception et) {
       }
     }
     return false;
   }
   return flag;
 }
  /**
   * 准备数据查询条件
   *
   * @param strSQL String
   * @return boolean
   */
  public boolean prepareData(String strSQL) {
    if (mResultSet != null) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "prepareData";
      tError.errorMessage = "数据集非空,程序在准备数据集之后,没有关闭!";
      this.mErrors.addOneError(tError);
      return false;
    }

    if (!mflag) {
      con = DBConnPool.getConnection();
    }
    try {
      mStatement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      mResultSet = mStatement.executeQuery(StrTool.GBKToUnicode(strSQL));
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "prepareData";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);
      try {
        mResultSet.close();
      } catch (Exception ex2) {
      }
      try {
        mStatement.close();
      } catch (Exception ex3) {
      }
      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
      return false;
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }
    return true;
  }
 /**
  * 关闭数据集
  *
  * @return boolean
  */
 public boolean closeData() {
   boolean flag = true;
   try {
     if (null == mResultSet) {
       CError tError = new CError();
       tError.moduleName = "LEDEPolicyMailInfoDB";
       tError.functionName = "closeData";
       tError.errorMessage = "数据集已经关闭了!";
       this.mErrors.addOneError(tError);
       flag = false;
     } else {
       mResultSet.close();
       mResultSet = null;
     }
   } catch (Exception ex2) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "closeData";
     tError.errorMessage = ex2.toString();
     this.mErrors.addOneError(tError);
     flag = false;
   }
   try {
     if (null == mStatement) {
       CError tError = new CError();
       tError.moduleName = "LEDEPolicyMailInfoDB";
       tError.functionName = "closeData";
       tError.errorMessage = "语句已经关闭了!";
       this.mErrors.addOneError(tError);
       flag = false;
     } else {
       mStatement.close();
       mStatement = null;
     }
   } catch (Exception ex3) {
     CError tError = new CError();
     tError.moduleName = "LEDEPolicyMailInfoDB";
     tError.functionName = "closeData";
     tError.errorMessage = ex3.toString();
     this.mErrors.addOneError(tError);
     flag = false;
   }
   return flag;
 }
  /**
   * 使用 ResultSet 中的第 i 行给 Schema 赋值
   *
   * @param: rs ResultSet
   * @param: i int
   * @return: boolean
   */
  public boolean setSchema(ResultSet rs, int i) {
    try {
      // rs.absolute(i);		// 非滚动游标
      if (rs.getString("recommend") == null) this.recommend = null;
      else this.recommend = rs.getString("recommend").trim();

      if (rs.getString("recommended") == null) this.recommended = null;
      else this.recommended = rs.getString("recommended").trim();

      this.sendtimes = rs.getInt("sendtimes");
      if (rs.getString("success") == null) this.success = null;
      else this.success = rs.getString("success").trim();

      if (rs.getString("registered") == null) this.registered = null;
      else this.registered = rs.getString("registered").trim();

      if (rs.getString("field1") == null) this.field1 = null;
      else this.field1 = rs.getString("field1").trim();

      if (rs.getString("field2") == null) this.field2 = null;
      else this.field2 = rs.getString("field2").trim();

      if (rs.getString("field3") == null) this.field3 = null;
      else this.field3 = rs.getString("field3").trim();

      if (rs.getString("makedate") == null) this.makedate = null;
      else this.makedate = rs.getString("makedate").trim();

      if (rs.getString("maketime") == null) this.maketime = null;
      else this.maketime = rs.getString("maketime").trim();

      if (rs.getString("modifydate") == null) this.modifydate = null;
      else this.modifydate = rs.getString("modifydate").trim();

      if (rs.getString("modifytime") == null) this.modifytime = null;
      else this.modifytime = rs.getString("modifytime").trim();

    } catch (SQLException sqle) {
      System.out.println(
          "数据库中的LECRecommendation表字段个数和Schema中的字段个数不一致,或者执行db.executeQuery查询时没有使用select * from tables");
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LECRecommendationSchema";
      tError.functionName = "setSchema";
      tError.errorMessage = sqle.toString();
      this.mErrors.addOneError(tError);
      return false;
    }
    return true;
  }
  public LEDEPolicyMailInfoSet executeQuery(String sql, int nStart, int nCount) {
    Statement stmt = null;
    ResultSet rs = null;
    LEDEPolicyMailInfoSet aLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);

      rs = stmt.executeQuery(StrTool.GBKToUnicode(sql));
      int i = 0;
      while (rs.next()) {
        i++;

        if (i < nStart) {
          continue;
        }

        if (i >= nStart + nCount) {
          break;
        }

        LEDEPolicyMailInfoSchema s1 = new LEDEPolicyMailInfoSchema();
        if (!s1.setSchema(rs, i)) {
          // @@错误处理
          CError tError = new CError();
          tError.moduleName = "LEDEPolicyMailInfoDB";
          tError.functionName = "executeQuery";
          tError.errorMessage = "sql语句有误,请查看表名及字段名信息!";
          this.mErrors.addOneError(tError);
        }
        aLEDEPolicyMailInfoSet.add(s1);
      }
      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        stmt.close();
      } catch (Exception ex1) {
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "executeQuery";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        stmt.close();
      } catch (Exception ex3) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return aLEDEPolicyMailInfoSet;
  }
  public LEDEPolicyMailInfoSet query() {
    Statement stmt = null;
    ResultSet rs = null;
    LEDEPolicyMailInfoSet aLEDEPolicyMailInfoSet = new LEDEPolicyMailInfoSet();

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
      SQLString sqlObj = new SQLString("LEDEPolicyMailInfo");
      LEDEPolicyMailInfoSchema aSchema = this.getSchema();
      sqlObj.setSQL(5, aSchema);
      String sql = sqlObj.getSQL();

      rs = stmt.executeQuery(sql);
      int i = 0;
      while (rs.next()) {
        i++;
        LEDEPolicyMailInfoSchema s1 = new LEDEPolicyMailInfoSchema();
        s1.setSchema(rs, i);
        aLEDEPolicyMailInfoSet.add(s1);
      }
      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        stmt.close();
      } catch (Exception ex1) {
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "query";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        stmt.close();
      } catch (Exception ex3) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
    }

    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return aLEDEPolicyMailInfoSet;
  }
  public boolean getInfo() {
    PreparedStatement pstmt = null;
    ResultSet rs = null;

    if (!mflag) {
      con = DBConnPool.getConnection();
    }

    try {
      pstmt =
          con.prepareStatement(
              "SELECT * FROM LEDEPolicyMailInfo WHERE  FreeNo = ?",
              ResultSet.TYPE_FORWARD_ONLY,
              ResultSet.CONCUR_READ_ONLY);
      if (this.getFreeNo() == null || this.getFreeNo().equals("null")) {
        pstmt.setNull(1, 12);
      } else {
        pstmt.setString(1, this.getFreeNo());
      }
      rs = pstmt.executeQuery();
      int i = 0;
      while (rs.next()) {
        i++;
        if (!this.setSchema(rs, i)) {
          // @@错误处理
          CError tError = new CError();
          tError.moduleName = "LEDEPolicyMailInfoDB";
          tError.functionName = "getInfo";
          tError.errorMessage = "取数失败!";
          this.mErrors.addOneError(tError);

          try {
            rs.close();
          } catch (Exception ex) {
          }
          try {
            pstmt.close();
          } catch (Exception ex1) {
          }

          if (!mflag) {
            try {
              con.close();
            } catch (Exception et) {
            }
          }
          return false;
        }
        break;
      }
      try {
        rs.close();
      } catch (Exception ex2) {
      }
      try {
        pstmt.close();
      } catch (Exception ex3) {
      }

      if (i == 0) {
        if (!mflag) {
          try {
            con.close();
          } catch (Exception et) {
          }
        }
        return false;
      }
    } catch (Exception e) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEDEPolicyMailInfoDB";
      tError.functionName = "getInfo";
      tError.errorMessage = e.toString();
      this.mErrors.addOneError(tError);

      try {
        rs.close();
      } catch (Exception ex) {
      }
      try {
        pstmt.close();
      } catch (Exception ex1) {
      }

      if (!mflag) {
        try {
          con.close();
        } catch (Exception et) {
        }
      }
      return false;
    }
    // 断开数据库连接
    if (!mflag) {
      try {
        con.close();
      } catch (Exception e) {
      }
    }

    return true;
  }
  /**
   * 使用 ResultSet 中的第 i 行给 Schema 赋值
   *
   * @param: rs ResultSet
   * @param: i int
   * @return: boolean
   */
  public boolean setSchema(ResultSet rs, int i) {
    try {
      // rs.absolute(i);		// 非滚动游标
      if (rs.getString("tradeNo") == null) this.tradeNo = null;
      else this.tradeNo = rs.getString("tradeNo").trim();

      if (rs.getString("contNo") == null) this.contNo = null;
      else this.contNo = rs.getString("contNo").trim();

      if (rs.getString("UserCode") == null) this.userCode = null;
      else this.userCode = rs.getString("UserCode").trim();

      if (rs.getString("Name") == null) this.name = null;
      else this.name = rs.getString("Name").trim();

      if (rs.getString("Gender") == null) this.gender = null;
      else this.gender = rs.getString("Gender").trim();

      this.birthday = rs.getDate("Birthday");
      if (rs.getString("Province") == null) this.province = null;
      else this.province = rs.getString("Province").trim();

      if (rs.getString("City") == null) this.city = null;
      else this.city = rs.getString("City").trim();

      if (rs.getString("Mobile") == null) this.mobile = null;
      else this.mobile = rs.getString("Mobile").trim();

      if (rs.getString("UserIDType") == null) this.userIDType = null;
      else this.userIDType = rs.getString("UserIDType").trim();

      if (rs.getString("UserIDNo") == null) this.userIDNo = null;
      else this.userIDNo = rs.getString("UserIDNo").trim();

      if (rs.getString("riskname") == null) this.riskname = null;
      else this.riskname = rs.getString("riskname").trim();

      if (rs.getString("riskcode") == null) this.riskcode = null;
      else this.riskcode = rs.getString("riskcode").trim();

      if (rs.getString("UserState") == null) this.userState = null;
      else this.userState = rs.getString("UserState").trim();

      if (rs.getString("UserSource") == null) this.userSource = null;
      else this.userSource = rs.getString("UserSource").trim();

      if (rs.getString("field1") == null) this.field1 = null;
      else this.field1 = rs.getString("field1").trim();

      if (rs.getString("field2") == null) this.field2 = null;
      else this.field2 = rs.getString("field2").trim();

      if (rs.getString("field3") == null) this.field3 = null;
      else this.field3 = rs.getString("field3").trim();

      if (rs.getString("field4") == null) this.field4 = null;
      else this.field4 = rs.getString("field4").trim();

      if (rs.getString("field5") == null) this.field5 = null;
      else this.field5 = rs.getString("field5").trim();

      if (rs.getString("field6") == null) this.field6 = null;
      else this.field6 = rs.getString("field6").trim();

      this.searchDate = rs.getDate("searchDate");
      if (rs.getString("searchTime") == null) this.searchTime = null;
      else this.searchTime = rs.getString("searchTime").trim();

      this.makedate = rs.getDate("makedate");
      if (rs.getString("maketime") == null) this.maketime = null;
      else this.maketime = rs.getString("maketime").trim();

    } catch (SQLException sqle) {
      System.out.println(
          "数据库中的SearchRecord表字段个数和Schema中的字段个数不一致,或者执行db.executeQuery查询时没有使用select * from tables");
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "SearchRecordSchema";
      tError.functionName = "setSchema";
      tError.errorMessage = sqle.toString();
      this.mErrors.addOneError(tError);
      return false;
    }
    return true;
  }