public int update(ValueObject obj) throws SQLException { if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : update() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; Connection conn = null; PreparedStatement ps = null; int result = 0; StringBuffer sb = new StringBuffer(); sb.append("update PT_KICA_ERR_LOG set ") .append("U_D_FLAG = ") .append(toDB(entity.getU_D_FLAG())) .append(",") .append("YYYYMMDD = ") .append(toDB(entity.getYYYYMMDD())) .append(",") .append("TRANSHOUR = ") .append(toDB(entity.getTRANSHOUR())) .append(",") .append("FILENAME = ") .append(toDB(entity.getFILENAME())) .append(",") .append("ERRLOG = ") .append(toDB(entity.getERRLOG())) .append(",") .append("RESULT_FLAG = ") .append(toDB(entity.getRESULT_FLAG())) .append(",") .append("UPD_DT = ") .append(toDB(entity.getUPD_DT())) .append(",") .append("INS_DT = ") .append(toDB(entity.getINS_DT())) .append(" where 1=1 "); sb.append(" and SEQ = ").append(toDB(entity.getSEQ())); KJFLog.sql(sb.toString()); try { conn = this.getConnection(); ps = conn.prepareStatement(sb.toString()); int i = 1; result = ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { if (ps != null) ps.close(); this.release(conn); } return result; }
public String insertSql(ValueObject obj) throws SQLException { if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : insert() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; StringBuffer sb = new StringBuffer(); sb.append("insert into PT_KICA_ERR_LOG ") .append(" ( SEQ,U_D_FLAG,YYYYMMDD,TRANSHOUR,FILENAME,ERRLOG,RESULT_FLAG,UPD_DT,INS_DT ) ") .append(" values ( ") .append(toDB(entity.getSEQ())) .append(",") .append(toDB(entity.getU_D_FLAG())) .append(",") .append(toDB(entity.getYYYYMMDD())) .append(",") .append(toDB(entity.getTRANSHOUR())) .append(",") .append(toDB(entity.getFILENAME())) .append(",") .append(toDB(entity.getERRLOG())) .append(",") .append(toDB(entity.getRESULT_FLAG())) .append(",") .append(toDB(entity.getUPD_DT())) .append(",") .append(toDB(entity.getINS_DT())) .append(" ) "); return sb.toString(); }
public int delete(ValueObject obj) throws SQLException { if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : delete() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; Connection conn = null; PreparedStatement ps = null; int result = 0; StringBuffer sb = new StringBuffer(); sb.append("delete from PT_KICA_ERR_LOG where 1=1") .append(" and SEQ = ") .append(toDB(entity.getSEQ())); KJFLog.sql(sb.toString()); try { conn = this.getConnection(); ps = conn.prepareStatement(sb.toString()); result = ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { if (ps != null) ps.close(); this.release(conn); } return result; }
public String updateModifiedOnlySql(ValueObject obj, String[] fields) throws SQLException { if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : updateModifiedOnly() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; HashMap clobs = new HashMap(); if (fields == null) throw new SQLException("Field Name can not be Null"); StringBuffer setString = new StringBuffer(); boolean flag = false; for (int i = 0; i < fields.length; i++) { if (fields[i] == null) throw new SQLException("Field Name can not be Null"); if (default_update_field.containsKey(fields[i]) == false) { if (flag) setString.append(","); flag = true; if (clobs.containsKey(fields[i])) { setString.append(fields[i]).append("=?"); } else { setString.append(fields[i]).append("=").append(toDB(entity.getByName(fields[i]))); } } } if (flag = false) throw new SQLException("Nothing to update"); StringBuffer sb = new StringBuffer(); sb.append("update PT_KICA_ERR_LOG set ").append(setString.toString()).append(" where 1=1 "); sb.append(" and SEQ = ").append(toDB(entity.getSEQ())); return sb.toString(); }
public int insert(ValueObject obj) throws SQLException { if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : insert() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; Connection conn = null; PreparedStatement ps = null; int result = 0; StringBuffer sb = new StringBuffer(); sb.append("insert into PT_KICA_ERR_LOG ") .append(" ( SEQ,U_D_FLAG,YYYYMMDD,TRANSHOUR,FILENAME,ERRLOG,RESULT_FLAG,UPD_DT,INS_DT ) ") .append(" values ( ") .append(toDB(entity.getSEQ())) .append(",") .append(toDB(entity.getU_D_FLAG())) .append(",") .append(toDB(entity.getYYYYMMDD())) .append(",") .append(toDB(entity.getTRANSHOUR())) .append(",") .append(toDB(entity.getFILENAME())) .append(",") .append(toDB(entity.getERRLOG())) .append(",") .append(toDB(entity.getRESULT_FLAG())) .append(",") .append(toDB(entity.getUPD_DT())) .append(",") .append(toDB(entity.getINS_DT())) .append(" ) "); KJFLog.sql(sb.toString()); try { conn = this.getConnection(); ps = conn.prepareStatement(sb.toString()); int i = 1; result = ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { if (ps != null) ps.close(); this.release(conn); } return result; }
public int update(ValueObject obj) throws SQLException { if ((obj instanceof PT_BBS_COM_FILESEntity) == false) { throw new SQLException("DAO 에러(1): PT_BBS_COM_FILES : update() "); } PT_BBS_COM_FILESEntity entity = (PT_BBS_COM_FILESEntity) obj; Connection conn = null; PreparedStatement ps = null; int result = 0; StringBuffer sb = new StringBuffer(); sb.append("update PT_BBS_COM_FILES set ") .append("CT_ID = ") .append(toDB(entity.getCT_ID())) .append(",") .append("BOARD_SEQ = ") .append(toDB(entity.getBOARD_SEQ())) .append(",") .append("FILE_REAL_NAME = ") .append(toDB(entity.getFILE_REAL_NAME())) .append(",") .append("FILE_SIZE = ") .append(toDB(entity.getFILE_SIZE())) .append(",") .append("UPD_DT = ") .append(toDB(entity.getUPD_DT())) .append(",") .append("DOWN_HIT = ") .append(toDB(entity.getDOWN_HIT())) .append(" where 1=1 "); sb.append(" and SYS_FILE_NAME = ").append(toDB(entity.getSYS_FILE_NAME())); KJFLog.sql(sb.toString()); try { conn = this.getConnection(); ps = conn.prepareStatement(sb.toString()); int i = 1; result = ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { if (ps != null) ps.close(); this.release(conn); } return result; }
public String deleteSql(ValueObject obj) throws SQLException { if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : delete() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; StringBuffer sb = new StringBuffer(); sb.append("delete from PT_KICA_ERR_LOG where 1=1") .append(" and SEQ = ") .append(toDB(entity.getSEQ())); return sb.toString(); }
public String updateSql(ValueObject obj) throws SQLException { if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : update() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; StringBuffer sb = new StringBuffer(); sb.append("update PT_KICA_ERR_LOG set ") .append("U_D_FLAG = ") .append(toDB(entity.getU_D_FLAG())) .append(",") .append("YYYYMMDD = ") .append(toDB(entity.getYYYYMMDD())) .append(",") .append("TRANSHOUR = ") .append(toDB(entity.getTRANSHOUR())) .append(",") .append("FILENAME = ") .append(toDB(entity.getFILENAME())) .append(",") .append("ERRLOG = ") .append(toDB(entity.getERRLOG())) .append(",") .append("RESULT_FLAG = ") .append(toDB(entity.getRESULT_FLAG())) .append(",") .append("UPD_DT = ") .append(toDB(entity.getUPD_DT())) .append(",") .append("INS_DT = ") .append(toDB(entity.getINS_DT())) .append(" where 1=1 "); sb.append(" and SEQ = ").append(toDB(entity.getSEQ())); return sb.toString(); }
public static String toXML(PT_R_M_UNION_STATEMENTEntity ent) { StringBuffer xml = new StringBuffer(); xml.append("<object type='object' name='").append(ent.getClass().getName()).append("' >\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("RECV_NUM") .append("'") .append(" value='") .append("" + ent.getRECV_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("SIDO_CODE") .append("'") .append(" value='") .append("" + ent.getSIDO_CODE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COI_WRT_NUM") .append("'") .append(" value='") .append("" + ent.getCOI_WRT_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("MOT_STE") .append("'") .append(" value='") .append("" + ent.getMOT_STE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("DEFI_STE") .append("'") .append(" value='") .append("" + ent.getDEFI_STE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("RECV_DT") .append("'") .append(" value='") .append("" + ent.getRECV_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("RECV_TIME") .append("'") .append(" value='") .append("" + ent.getRECV_TIME()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("PROC_LIM") .append("'") .append(" value='") .append("" + ent.getPROC_LIM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("PROC_TIME") .append("'") .append(" value='") .append("" + ent.getPROC_TIME()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COMMANA_CLASS") .append("'") .append(" value='") .append("" + ent.getCOMMANA_CLASS()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("MANA_NUM") .append("'") .append(" value='") .append("" + ent.getMANA_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("NAME") .append("'") .append(" value='") .append("" + ent.getNAME()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REP_SSN1") .append("'") .append(" value='") .append("" + ent.getREP_SSN1()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REP_SSN2") .append("'") .append(" value='") .append("" + ent.getREP_SSN2()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REP_NM_KOR") .append("'") .append(" value='") .append("" + ent.getREP_NM_KOR()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REP_NM_HAN") .append("'") .append(" value='") .append("" + ent.getREP_NM_HAN()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REP_TEL_NUM") .append("'") .append(" value='") .append("" + ent.getREP_TEL_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("ADDR_POST_NUM") .append("'") .append(" value='") .append("" + ent.getADDR_POST_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("ADDR_ADDR") .append("'") .append(" value='") .append("" + ent.getADDR_ADDR()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("ADDR_DETAIL_ADDR") .append("'") .append(" value='") .append("" + ent.getADDR_DETAIL_ADDR()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("ADDR_TEL_NUM") .append("'") .append(" value='") .append("" + ent.getADDR_TEL_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("ADDR_FAX_NUM") .append("'") .append(" value='") .append("" + ent.getADDR_FAX_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("EMAIL_ADDR") .append("'") .append(" value='") .append("" + ent.getEMAIL_ADDR()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("OFFICE_AREA") .append("'") .append(" value='") .append("" + ent.getOFFICE_AREA()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("OFFICE_USE_CODE") .append("'") .append(" value='") .append("" + ent.getOFFICE_USE_CODE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COMPANY_DIAG_CLASS_CODE") .append("'") .append(" value='") .append("" + ent.getCOMPANY_DIAG_CLASS_CODE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COMPANY_DIAG_BAS_DT") .append("'") .append(" value='") .append("" + ent.getCOMPANY_DIAG_BAS_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COMPANY_DIAG_ISSUE_DT") .append("'") .append(" value='") .append("" + ent.getCOMPANY_DIAG_ISSUE_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("DIAG_ORG_CODE") .append("'") .append(" value='") .append("" + ent.getDIAG_ORG_CODE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("DIAG_NM_NM") .append("'") .append(" value='") .append("" + ent.getDIAG_NM_NM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("DIAG_NM_WRT_NUM") .append("'") .append(" value='") .append("" + ent.getDIAG_NM_WRT_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("PAY_CAP") .append("'") .append(" value='") .append("" + ent.getPAY_CAP()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REA_CAP") .append("'") .append(" value='") .append("" + ent.getREA_CAP()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("TUP_AOM") .append("'") .append(" value='") .append("" + ent.getTUP_AOM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("TUP_CLASS_CODE") .append("'") .append(" value='") .append("" + ent.getTUP_CLASS_CODE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COM_COV_DT") .append("'") .append(" value='") .append("" + ent.getCOM_COV_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("BAS_STA_DT") .append("'") .append(" value='") .append("" + ent.getBAS_STA_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("OFFICE_OWN_CLASS") .append("'") .append(" value='") .append("" + ent.getOFFICE_OWN_CLASS()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REP_MOBILE") .append("'") .append(" value='") .append("" + ent.getREP_MOBILE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("LICTAX") .append("'") .append(" value='") .append("" + ent.getLICTAX()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("HOSCRE") .append("'") .append(" value='") .append("" + ent.getHOSCRE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COM_NUM") .append("'") .append(" value='") .append("" + ent.getCOM_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("GUBUN") .append("'") .append(" value='") .append("" + ent.getGUBUN()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("DOC_CODE") .append("'") .append(" value='") .append("" + ent.getDOC_CODE()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("OFFICE_USE_NAME") .append("'") .append(" value='") .append("" + ent.getOFFICE_USE_NAME()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("MEMO_CONT") .append("'") .append(" value='") .append("" + ent.getMEMO_CONT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("WRT_ID") .append("'") .append(" value='") .append("" + ent.getWRT_ID()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("INS_DT") .append("'") .append(" value='") .append("" + ent.getINS_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("UPD_DT") .append("'") .append(" value='") .append("" + ent.getUPD_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("TMP_WRT_NUM") .append("'") .append(" value='") .append("" + ent.getTMP_WRT_NUM()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("WRT_DT") .append("'") .append(" value='") .append("" + ent.getWRT_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("CHG_DT") .append("'") .append(" value='") .append("" + ent.getCHG_DT()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("CHGBRE_SEQ") .append("'") .append(" value='") .append("" + ent.getCHGBRE_SEQ()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("COMPANY_DIAG_BAS_DT2") .append("'") .append(" value='") .append("" + ent.getCOMPANY_DIAG_BAS_DT2()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("BUSS_YMD") .append("'") .append(" value='") .append("" + ent.getBUSS_YMD()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("FOREIGN_YN") .append("'") .append(" value='") .append("" + ent.getFOREIGN_YN()) .append("' />\n"); xml.append("<field type='") .append("String") .append("' ") .append(" name='") .append("REGIST_YMD") .append("'") .append(" value='") .append("" + ent.getREGIST_YMD()) .append("' />\n"); xml.append("</object>\n"); return xml.toString(); }
/////////////////////////////////////////////////////////////////////////////////// // 특정필드를 제외한 전체 필드를 수정한다. public int updateExcludeOnly(ValueObject obj, String[] fields) throws SQLException { fields = KJFUtil.getDifferenceOfSets(default_fields, fields); if ((obj instanceof PT_KICA_ERR_LOGEntity) == false) { throw new SQLException("DAO 에러(1): PT_KICA_ERR_LOG : updateModifiedOnly() "); } PT_KICA_ERR_LOGEntity entity = (PT_KICA_ERR_LOGEntity) obj; HashMap clobs = new HashMap(); Connection conn = null; PreparedStatement ps = null; int result = 0; if (fields == null) throw new SQLException("Field Name can not be Null"); StringBuffer setString = new StringBuffer(); boolean flag = false; for (int i = 0; i < fields.length; i++) { if (fields[i] == null) throw new SQLException("Field Name can not be Null"); if (default_update_field.containsKey(fields[i]) == false) { if (flag) setString.append(","); flag = true; if (clobs.containsKey(fields[i])) { setString.append(fields[i]).append("=?"); } else { setString.append(fields[i]).append("=").append(toDB(entity.getByName(fields[i]))); } } } if (flag = false) throw new SQLException("Nothing to update"); StringBuffer sb = new StringBuffer(); sb.append("update PT_KICA_ERR_LOG set ").append(setString.toString()).append(" where 1=1 "); sb.append(" and SEQ = ").append(toDB(entity.getSEQ())); KJFLog.sql(sb.toString()); try { conn = this.getConnection(); ps = conn.prepareStatement(sb.toString()); int k = 1; for (int i = 0; i < fields.length; i++) { if (clobs.containsKey(fields[i])) { ps.setString(k++, (entity.getByName(fields[i])).toString()); } } result = ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { if (ps != null) ps.close(); this.release(conn); } return result; }