/** * 获取定量数据 * * @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; }
/** * 准备数据查询条件 * * @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; }
/** * 使用 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; }
/** * 数据解包,解包顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLECRecommendation>历史记账凭证主表信息</A>表字段 * * @param: strMessage String 包含一条纪录数据的字符串 * @return: boolean */ public boolean decode(String strMessage) { try { recommend = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 1, SysConst.PACKAGESPILTER); recommended = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 2, SysConst.PACKAGESPILTER); sendtimes = new Integer(ChgData.chgNumericStr(StrTool.getStr(strMessage, 3, SysConst.PACKAGESPILTER))) .intValue(); success = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 4, SysConst.PACKAGESPILTER); registered = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 5, SysConst.PACKAGESPILTER); field1 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 6, SysConst.PACKAGESPILTER); field2 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 7, SysConst.PACKAGESPILTER); field3 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 8, SysConst.PACKAGESPILTER); makedate = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 9, SysConst.PACKAGESPILTER); maketime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 10, SysConst.PACKAGESPILTER); modifydate = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 11, SysConst.PACKAGESPILTER); modifytime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 12, SysConst.PACKAGESPILTER); } catch (NumberFormatException ex) { // @@错误处理 CError tError = new CError(); tError.moduleName = "LECRecommendationSchema"; tError.functionName = "decode"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); return false; } return true; }
/** * 删除操作 删除条件:主键 * * @return boolean */ public boolean delete() { PreparedStatement pstmt = null; if (!mflag) { con = DBConnPool.getConnection(); } try { int tCount = this.size(); pstmt = con.prepareStatement("DELETE FROM LEDOccupation WHERE OccupationCode = ?"); for (int i = 1; i <= tCount; i++) { if (this.get(i).getOccupationCode() == null || this.get(i).getOccupationCode().equals("null")) { pstmt.setString(1, null); } else { pstmt.setString(1, this.get(i).getOccupationCode()); } pstmt.addBatch(); } pstmt.executeBatch(); pstmt.close(); } catch (Exception ex) { // @@错误处理 ex.printStackTrace(); this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LEDOccupationDBSet"; tError.functionName = "delete()"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); try { pstmt.close(); } catch (Exception e) { e.printStackTrace(); } if (!mflag) { try { con.close(); } catch (Exception e) { e.printStackTrace(); } } return false; } if (!mflag) { try { con.close(); } catch (Exception e) { e.printStackTrace(); } } 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; }
public boolean delete() { PreparedStatement pstmt = null; if (!mflag) { con = DBConnPool.getConnection(); } try { pstmt = con.prepareStatement("DELETE FROM LEDAdSource WHERE ProductCode = ? AND SiteCode = ?"); if (this.getProductCode() == null || this.getProductCode().equals("null")) { pstmt.setNull(1, 12); } else { pstmt.setString(1, this.getProductCode()); } if (this.getSiteCode() == null || this.getSiteCode().equals("null")) { pstmt.setNull(2, 12); } else { pstmt.setString(2, this.getSiteCode()); } pstmt.executeUpdate(); pstmt.close(); } catch (Exception ex) { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LEDAdSourceDB"; tError.functionName = "delete()"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); try { pstmt.close(); } catch (Exception e) { } if (!mflag) { try { con.close(); } catch (Exception e) { } } return false; } if (!mflag) { try { con.close(); } catch (Exception e) { } } return true; }
/** * 获取数据集 * * @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; }
// @Method public boolean deleteSQL() { if (db.deleteSQL(this)) { return true; } else { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LECBnfDBSet"; tError.functionName = "deleteSQL"; tError.errorMessage = "操作失败!"; this.mErrors.addOneError(tError); return false; } }
/** * 使用 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; }
// @Method public boolean deleteSQL() { LEDEPolicyMailInfoSchema tSchema = this.getSchema(); if (db.deleteSQL(tSchema)) { return true; } else { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LEDEPolicyMailInfoDB"; tError.functionName = "deleteSQL"; tError.errorMessage = "操作失败!"; this.mErrors.addOneError(tError); return false; } }
/** * 数据解包,解包顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpSearchRecord>历史记账凭证主表信息</A>表字段 * * @param: strMessage String 包含一条纪录数据的字符串 * @return: boolean */ public boolean decode(String strMessage) { try { tradeNo = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 1, SysConst.PACKAGESPILTER); contNo = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 2, SysConst.PACKAGESPILTER); userCode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 3, SysConst.PACKAGESPILTER); name = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 4, SysConst.PACKAGESPILTER); gender = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 5, SysConst.PACKAGESPILTER); birthday = fDate.getDate( StrTool.getStr(StrTool.GBKToUnicode(strMessage), 6, SysConst.PACKAGESPILTER)); province = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 7, SysConst.PACKAGESPILTER); city = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 8, SysConst.PACKAGESPILTER); mobile = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 9, SysConst.PACKAGESPILTER); userIDType = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 10, SysConst.PACKAGESPILTER); userIDNo = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 11, SysConst.PACKAGESPILTER); riskname = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 12, SysConst.PACKAGESPILTER); riskcode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 13, SysConst.PACKAGESPILTER); userState = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 14, SysConst.PACKAGESPILTER); userSource = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 15, SysConst.PACKAGESPILTER); field1 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 16, SysConst.PACKAGESPILTER); field2 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 17, SysConst.PACKAGESPILTER); field3 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 18, SysConst.PACKAGESPILTER); field4 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 19, SysConst.PACKAGESPILTER); field5 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 20, SysConst.PACKAGESPILTER); field6 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 21, SysConst.PACKAGESPILTER); searchDate = fDate.getDate( StrTool.getStr(StrTool.GBKToUnicode(strMessage), 22, SysConst.PACKAGESPILTER)); searchTime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 23, SysConst.PACKAGESPILTER); makedate = fDate.getDate( StrTool.getStr(StrTool.GBKToUnicode(strMessage), 24, SysConst.PACKAGESPILTER)); maketime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 25, SysConst.PACKAGESPILTER); } catch (NumberFormatException ex) { // @@错误处理 CError tError = new CError(); tError.moduleName = "SearchRecordSchema"; tError.functionName = "decode"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); return false; } return true; }
public int getCount() { LEDEPolicyMailInfoSchema tSchema = this.getSchema(); int tCount = db.getCount(tSchema); if (tCount < 0) { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LEDEPolicyMailInfoDB"; tError.functionName = "getCount"; tError.errorMessage = "操作失败!"; this.mErrors.addOneError(tError); return -1; } return tCount; }
/** * 数据解包,解包顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLEPRiskDuty>历史记账凭证主表信息</A>表字段 * * @param: strMessage String 包含一条纪录数据的字符串 * @return: boolean */ public boolean decode(String strMessage) { try { riskCode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 1, SysConst.PACKAGESPILTER); riskVer = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 2, SysConst.PACKAGESPILTER); dutyCode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 3, SysConst.PACKAGESPILTER); choFlag = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 4, SysConst.PACKAGESPILTER); specFlag = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 5, SysConst.PACKAGESPILTER); } catch (NumberFormatException ex) { // @@错误处理 CError tError = new CError(); tError.moduleName = "LEPRiskDutySchema"; tError.functionName = "decode"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); return false; } return true; }
/** * 新增操作 * * @return boolean */ public boolean insert() { PreparedStatement pstmt = null; if (!mflag) { con = DBConnPool.getConnection(); } try { int tCount = this.size(); pstmt = con.prepareStatement( "INSERT INTO LECBnf VALUES( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)"); for (int i = 1; i <= tCount; i++) { if (this.get(i).getContNo() == null || this.get(i).getContNo().equals("null")) { pstmt.setString(1, null); } else { pstmt.setString(1, this.get(i).getContNo()); } if (this.get(i).getPolNo() == null || this.get(i).getPolNo().equals("null")) { pstmt.setString(2, null); } else { pstmt.setString(2, this.get(i).getPolNo()); } if (this.get(i).getInsuredNo() == null || this.get(i).getInsuredNo().equals("null")) { pstmt.setString(3, null); } else { pstmt.setString(3, this.get(i).getInsuredNo()); } if (this.get(i).getBnfType() == null || this.get(i).getBnfType().equals("null")) { pstmt.setString(4, null); } else { pstmt.setString(4, this.get(i).getBnfType()); } pstmt.setDouble(5, this.get(i).getBnfNo()); if (this.get(i).getBnfGrade() == null || this.get(i).getBnfGrade().equals("null")) { pstmt.setString(6, null); } else { pstmt.setString(6, this.get(i).getBnfGrade()); } if (this.get(i).getRelationToInsured() == null || this.get(i).getRelationToInsured().equals("null")) { pstmt.setString(7, null); } else { pstmt.setString(7, this.get(i).getRelationToInsured()); } pstmt.setDouble(8, this.get(i).getBnfLot()); if (this.get(i).getCustomerNo() == null || this.get(i).getCustomerNo().equals("null")) { pstmt.setString(9, null); } else { pstmt.setString(9, this.get(i).getCustomerNo()); } if (this.get(i).getName() == null || this.get(i).getName().equals("null")) { pstmt.setString(10, null); } else { pstmt.setString(10, this.get(i).getName()); } if (this.get(i).getSex() == null || this.get(i).getSex().equals("null")) { pstmt.setString(11, null); } else { pstmt.setString(11, this.get(i).getSex()); } if (this.get(i).getBirthday() == null || this.get(i).getBirthday().equals("null")) { pstmt.setDate(12, null); } else { pstmt.setDate(12, Date.valueOf(this.get(i).getBirthday())); } if (this.get(i).getBnfIDType() == null || this.get(i).getBnfIDType().equals("null")) { pstmt.setString(13, null); } else { pstmt.setString(13, this.get(i).getBnfIDType()); } if (this.get(i).getBnfIDNo() == null || this.get(i).getBnfIDNo().equals("null")) { pstmt.setString(14, null); } else { pstmt.setString(14, this.get(i).getBnfIDNo()); } if (this.get(i).getOperator() == null || this.get(i).getOperator().equals("null")) { pstmt.setString(15, null); } else { pstmt.setString(15, this.get(i).getOperator()); } if (this.get(i).getMakeDate() == null || this.get(i).getMakeDate().equals("null")) { pstmt.setDate(16, null); } else { pstmt.setDate(16, Date.valueOf(this.get(i).getMakeDate())); } if (this.get(i).getMakeTime() == null || this.get(i).getMakeTime().equals("null")) { pstmt.setString(17, null); } else { pstmt.setString(17, this.get(i).getMakeTime()); } if (this.get(i).getModifyDate() == null || this.get(i).getModifyDate().equals("null")) { pstmt.setDate(18, null); } else { pstmt.setDate(18, Date.valueOf(this.get(i).getModifyDate())); } if (this.get(i).getModifyTime() == null || this.get(i).getModifyTime().equals("null")) { pstmt.setString(19, null); } else { pstmt.setString(19, this.get(i).getModifyTime()); } pstmt.addBatch(); } pstmt.executeBatch(); pstmt.close(); } catch (Exception ex) { // @@错误处理 ex.printStackTrace(); this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LECBnfDBSet"; tError.functionName = "insert()"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); try { pstmt.close(); } catch (Exception e) { e.printStackTrace(); } if (!mflag) { try { con.close(); } catch (Exception e) { e.printStackTrace(); } } return false; } if (!mflag) { try { con.close(); } catch (Exception e) { e.printStackTrace(); } } 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; }
public boolean insert() { PreparedStatement pstmt = null; if (!mflag) { con = DBConnPool.getConnection(); } try { pstmt = con.prepareStatement( "INSERT INTO LECInsured VALUES( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)"); if (this.getContNo() == null || this.getContNo().equals("null")) { pstmt.setNull(1, 12); } else { pstmt.setString(1, this.getContNo()); } if (this.getInsuredNo() == null || this.getInsuredNo().equals("null")) { pstmt.setNull(2, 12); } else { pstmt.setString(2, this.getInsuredNo()); } if (this.getAppntNo() == null || this.getAppntNo().equals("null")) { pstmt.setNull(3, 12); } else { pstmt.setString(3, this.getAppntNo()); } if (this.getManageCom() == null || this.getManageCom().equals("null")) { pstmt.setNull(4, 12); } else { pstmt.setString(4, this.getManageCom()); } if (this.getExecuteCom() == null || this.getExecuteCom().equals("null")) { pstmt.setNull(5, 12); } else { pstmt.setString(5, this.getExecuteCom()); } if (this.getMasterContNo() == null || this.getMasterContNo().equals("null")) { pstmt.setNull(6, 12); } else { pstmt.setString(6, this.getMasterContNo()); } if (this.getMasterInsuredNo() == null || this.getMasterInsuredNo().equals("null")) { pstmt.setNull(7, 12); } else { pstmt.setString(7, this.getMasterInsuredNo()); } if (this.getRelationToMainInsured() == null || this.getRelationToMainInsured().equals("null")) { pstmt.setNull(8, 12); } else { pstmt.setString(8, this.getRelationToMainInsured()); } if (this.getRelationToAppnt() == null || this.getRelationToAppnt().equals("null")) { pstmt.setNull(9, 12); } else { pstmt.setString(9, this.getRelationToAppnt()); } if (this.getAddressNo() == null || this.getAddressNo().equals("null")) { pstmt.setNull(10, 12); } else { pstmt.setString(10, this.getAddressNo()); } if (this.getName() == null || this.getName().equals("null")) { pstmt.setNull(11, 12); } else { pstmt.setString(11, this.getName()); } if (this.getSex() == null || this.getSex().equals("null")) { pstmt.setNull(12, 12); } else { pstmt.setString(12, this.getSex()); } if (this.getBirthday() == null || this.getBirthday().equals("null")) { pstmt.setNull(13, 91); } else { pstmt.setDate(13, Date.valueOf(this.getBirthday())); } if (this.getInsuredIDType() == null || this.getInsuredIDType().equals("null")) { pstmt.setNull(14, 12); } else { pstmt.setString(14, this.getInsuredIDType()); } if (this.getInsuredIDNo() == null || this.getInsuredIDNo().equals("null")) { pstmt.setNull(15, 12); } else { pstmt.setString(15, this.getInsuredIDNo()); } if (this.getNationality() == null || this.getNationality().equals("null")) { pstmt.setNull(16, 12); } else { pstmt.setString(16, this.getNationality()); } if (this.getMarriage() == null || this.getMarriage().equals("null")) { pstmt.setNull(17, 12); } else { pstmt.setString(17, this.getMarriage()); } if (this.getHealth() == null || this.getHealth().equals("null")) { pstmt.setNull(18, 12); } else { pstmt.setString(18, this.getHealth()); } pstmt.setDouble(19, this.getStature()); pstmt.setDouble(20, this.getAvoirdupois()); if (this.getDegree() == null || this.getDegree().equals("null")) { pstmt.setNull(21, 12); } else { pstmt.setString(21, this.getDegree()); } if (this.getCreditGrade() == null || this.getCreditGrade().equals("null")) { pstmt.setNull(22, 12); } else { pstmt.setString(22, this.getCreditGrade()); } if (this.getBankName() == null || this.getBankName().equals("null")) { pstmt.setNull(23, 12); } else { pstmt.setString(23, this.getBankName()); } if (this.getAccName() == null || this.getAccName().equals("null")) { pstmt.setNull(24, 12); } else { pstmt.setString(24, this.getAccName()); } if (this.getBankAccNo() == null || this.getBankAccNo().equals("null")) { pstmt.setNull(25, 12); } else { pstmt.setString(25, this.getBankAccNo()); } if (this.getOccupationType() == null || this.getOccupationType().equals("null")) { pstmt.setNull(26, 12); } else { pstmt.setString(26, this.getOccupationType()); } if (this.getOccupationCode() == null || this.getOccupationCode().equals("null")) { pstmt.setNull(27, 12); } else { pstmt.setString(27, this.getOccupationCode()); } if (this.getWorkType() == null || this.getWorkType().equals("null")) { pstmt.setNull(28, 12); } else { pstmt.setString(28, this.getWorkType()); } if (this.getPluralityType() == null || this.getPluralityType().equals("null")) { pstmt.setNull(29, 12); } else { pstmt.setString(29, this.getPluralityType()); } if (this.getSmokeFlag() == null || this.getSmokeFlag().equals("null")) { pstmt.setNull(30, 12); } else { pstmt.setString(30, this.getSmokeFlag()); } if (this.getContPlanCode() == null || this.getContPlanCode().equals("null")) { pstmt.setNull(31, 12); } else { pstmt.setString(31, this.getContPlanCode()); } pstmt.setDouble(32, this.getBMI()); pstmt.setDouble(33, this.getInsuredPeoples()); if (this.getInsuredState() == null || this.getInsuredState().equals("null")) { pstmt.setNull(34, 12); } else { pstmt.setString(34, this.getInsuredState()); } if (this.getOperator() == null || this.getOperator().equals("null")) { pstmt.setNull(35, 12); } else { pstmt.setString(35, this.getOperator()); } if (this.getMakeDate() == null || this.getMakeDate().equals("null")) { pstmt.setNull(36, 91); } else { pstmt.setDate(36, Date.valueOf(this.getMakeDate())); } if (this.getMakeTime() == null || this.getMakeTime().equals("null")) { pstmt.setNull(37, 12); } else { pstmt.setString(37, this.getMakeTime()); } if (this.getModifyDate() == null || this.getModifyDate().equals("null")) { pstmt.setNull(38, 91); } else { pstmt.setDate(38, Date.valueOf(this.getModifyDate())); } if (this.getModifyTime() == null || this.getModifyTime().equals("null")) { pstmt.setNull(39, 12); } else { pstmt.setString(39, this.getModifyTime()); } // execute sql pstmt.executeUpdate(); pstmt.close(); } catch (Exception ex) { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LECInsuredDB"; tError.functionName = "insert()"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); try { pstmt.close(); } catch (Exception e) { } if (!mflag) { try { con.close(); } catch (Exception e) { } } return false; } if (!mflag) { try { con.close(); } catch (Exception e) { } } return true; }
public boolean insert() { PreparedStatement pstmt = null; if (!mflag) { con = DBConnPool.getConnection(); } try { pstmt = con.prepareStatement( "INSERT INTO LEDEPolicyMailInfo VALUES( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)"); if (this.getFreeNo() == null || this.getFreeNo().equals("null")) { pstmt.setNull(1, 12); } else { pstmt.setString(1, this.getFreeNo()); } if (this.getEmail() == null || this.getEmail().equals("null")) { pstmt.setNull(2, 12); } else { pstmt.setString(2, this.getEmail()); } if (this.getName() == null || this.getName().equals("null")) { pstmt.setNull(3, 12); } else { pstmt.setString(3, this.getName()); } if (this.getMailContent() == null || this.getMailContent().equals("null")) { pstmt.setNull(4, 12); } else { pstmt.setString(4, this.getMailContent()); } if (this.getPdfAddress() == null || this.getPdfAddress().equals("null")) { pstmt.setNull(5, 12); } else { pstmt.setString(5, this.getPdfAddress()); } if (this.getSendMailFlg() == null || this.getSendMailFlg().equals("null")) { pstmt.setNull(6, 12); } else { pstmt.setString(6, this.getSendMailFlg()); } if (this.getSendMailDate() == null || this.getSendMailDate().equals("null")) { pstmt.setNull(7, 93); } else { pstmt.setDate(7, Date.valueOf(this.getSendMailDate())); } if (this.getSendMailTime() == null || this.getSendMailTime().equals("null")) { pstmt.setNull(8, 12); } else { pstmt.setString(8, this.getSendMailTime()); } if (this.getProductCode() == null || this.getProductCode().equals("null")) { pstmt.setNull(9, 12); } else { pstmt.setString(9, this.getProductCode()); } if (this.getOperator() == null || this.getOperator().equals("null")) { pstmt.setNull(10, 12); } else { pstmt.setString(10, this.getOperator()); } if (this.getMakeDate() == null || this.getMakeDate().equals("null")) { pstmt.setNull(11, 93); } else { pstmt.setDate(11, Date.valueOf(this.getMakeDate())); } if (this.getMakeTime() == null || this.getMakeTime().equals("null")) { pstmt.setNull(12, 12); } else { pstmt.setString(12, this.getMakeTime()); } if (this.getModifyDate() == null || this.getModifyDate().equals("null")) { pstmt.setNull(13, 93); } else { pstmt.setDate(13, Date.valueOf(this.getModifyDate())); } if (this.getModifyTime() == null || this.getModifyTime().equals("null")) { pstmt.setNull(14, 12); } else { pstmt.setString(14, this.getModifyTime()); } // execute sql pstmt.executeUpdate(); pstmt.close(); } catch (Exception ex) { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LEDEPolicyMailInfoDB"; tError.functionName = "insert()"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); try { pstmt.close(); } catch (Exception e) { } if (!mflag) { try { con.close(); } catch (Exception e) { } } return false; } if (!mflag) { try { con.close(); } catch (Exception e) { } } return true; }
public boolean update(String strWherePart) { Statement stmt = null; 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(2, aSchema); String sql = "update LEDEPolicyMailInfo " + sqlObj.getUpdPart() + " where " + strWherePart; int operCount = stmt.executeUpdate(sql); if (operCount == 0) { // @@错误处理 CError tError = new CError(); tError.moduleName = "LEDEPolicyMailInfoDB"; tError.functionName = "update"; tError.errorMessage = "更新数据失败!"; this.mErrors.addOneError(tError); if (!mflag) { try { con.close(); } catch (Exception et) { } } return false; } } catch (Exception e) { // @@错误处理 CError tError = new CError(); tError.moduleName = "LEDEPolicyMailInfoDB"; tError.functionName = "update"; tError.errorMessage = e.toString(); this.mErrors.addOneError(tError); try { stmt.close(); } catch (Exception ex1) { } if (!mflag) { try { con.close(); } catch (Exception et) { } } return false; } // 断开数据库连接 if (!mflag) { try { con.close(); } catch (Exception e) { } } 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 boolean insert() { PreparedStatement pstmt = null; if (!mflag) { con = DBConnPool.getConnection(); } try { pstmt = con.prepareStatement("INSERT INTO LEDAdSource VALUES( ? , ? , ? , ? , ? , ? , ? , ?)"); if (this.getProductCode() == null || this.getProductCode().equals("null")) { pstmt.setNull(1, 12); } else { pstmt.setString(1, this.getProductCode()); } if (this.getSiteName() == null || this.getSiteName().equals("null")) { pstmt.setNull(2, 12); } else { pstmt.setString(2, this.getSiteName()); } if (this.getSiteCode() == null || this.getSiteCode().equals("null")) { pstmt.setNull(3, 12); } else { pstmt.setString(3, this.getSiteCode()); } if (this.getSiteType() == null || this.getSiteType().equals("null")) { pstmt.setNull(4, 12); } else { pstmt.setString(4, this.getSiteType()); } if (this.getUrl() == null || this.getUrl().equals("null")) { pstmt.setNull(5, 12); } else { pstmt.setString(5, this.getUrl()); } if (this.getContent() == null || this.getContent().equals("null")) { pstmt.setNull(6, 12); } else { pstmt.setString(6, this.getContent()); } if (this.getPayMode() == null || this.getPayMode().equals("null")) { pstmt.setNull(7, 12); } else { pstmt.setString(7, this.getPayMode()); } if (this.getVisitedPage() == null || this.getVisitedPage().equals("null")) { pstmt.setNull(8, 12); } else { pstmt.setString(8, this.getVisitedPage()); } // execute sql pstmt.executeUpdate(); pstmt.close(); } catch (Exception ex) { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LEDAdSourceDB"; tError.functionName = "insert()"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); try { pstmt.close(); } catch (Exception e) { } if (!mflag) { try { con.close(); } catch (Exception e) { } } return false; } if (!mflag) { try { con.close(); } catch (Exception e) { } } return true; }
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; }
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 update() { PreparedStatement pstmt = null; if (!mflag) { con = DBConnPool.getConnection(); } try { pstmt = con.prepareStatement( "UPDATE LEDAdSource SET ProductCode = ? , SiteName = ? , SiteCode = ? , SiteType = ? , Url = ? , Content = ? , PayMode = ? , VisitedPage = ? WHERE ProductCode = ? AND SiteCode = ?"); if (this.getProductCode() == null || this.getProductCode().equals("null")) { pstmt.setNull(1, 12); } else { pstmt.setString(1, this.getProductCode()); } if (this.getSiteName() == null || this.getSiteName().equals("null")) { pstmt.setNull(2, 12); } else { pstmt.setString(2, this.getSiteName()); } if (this.getSiteCode() == null || this.getSiteCode().equals("null")) { pstmt.setNull(3, 12); } else { pstmt.setString(3, this.getSiteCode()); } if (this.getSiteType() == null || this.getSiteType().equals("null")) { pstmt.setNull(4, 12); } else { pstmt.setString(4, this.getSiteType()); } if (this.getUrl() == null || this.getUrl().equals("null")) { pstmt.setNull(5, 12); } else { pstmt.setString(5, this.getUrl()); } if (this.getContent() == null || this.getContent().equals("null")) { pstmt.setNull(6, 12); } else { pstmt.setString(6, this.getContent()); } if (this.getPayMode() == null || this.getPayMode().equals("null")) { pstmt.setNull(7, 12); } else { pstmt.setString(7, this.getPayMode()); } if (this.getVisitedPage() == null || this.getVisitedPage().equals("null")) { pstmt.setNull(8, 12); } else { pstmt.setString(8, this.getVisitedPage()); } // set where condition if (this.getProductCode() == null || this.getProductCode().equals("null")) { pstmt.setNull(9, 12); } else { pstmt.setString(9, this.getProductCode()); } if (this.getSiteCode() == null || this.getSiteCode().equals("null")) { pstmt.setNull(10, 12); } else { pstmt.setString(10, this.getSiteCode()); } pstmt.executeUpdate(); pstmt.close(); } catch (Exception ex) { // @@错误处理 this.mErrors.copyAllErrors(db.mErrors); CError tError = new CError(); tError.moduleName = "LEDAdSourceDB"; tError.functionName = "update()"; tError.errorMessage = ex.toString(); this.mErrors.addOneError(tError); try { pstmt.close(); } catch (Exception e) { } if (!mflag) { try { con.close(); } catch (Exception e) { } } return false; } if (!mflag) { try { con.close(); } catch (Exception e) { } } return true; }