@Override public BaseVo loadFromRS(ResultSet rs) { CmdCfgFile vo = new CmdCfgFile(); try { vo.setId(rs.getInt("id")); vo.setTimingId(rs.getInt("timingId")); vo.setIpaddress(rs.getString("ipaddress")); vo.setFileName(rs.getString("fileName")); vo.setContent(rs.getString("content")); vo.setFileSize(rs.getInt("file_size")); vo.setBackupTime(rs.getTimestamp("backup_time")); vo.setBkpType(rs.getString("bkp_type")); vo.setBaseline(rs.getInt("baseline")); } catch (Exception e) { SysLogger.error("VPNFileConfigDao.loadFromRS()", e); vo = null; } return vo; }
/** 查询所有巡检命令的Model */ public List<CmdCfgFile> loadAll() { String sql = "select * from nms_vpncfg"; List<CmdCfgFile> ccfList = new ArrayList<CmdCfgFile>(); ResultSet rs = null; try { rs = conn.executeQuery(sql); while (rs.next()) { CmdCfgFile ccf = new CmdCfgFile(); ccf.setId(rs.getInt("id")); ccf.setIpaddress(rs.getString("ipaddress")); ccf.setBackupTime(rs.getTimestamp("backup_time")); ccf.setBkpType(rs.getString("bkp_type")); ccfList.add(ccf); } return ccfList; } catch (Exception e) { e.printStackTrace(); System.out.println("List<CmdCfgFile> loadAll------------查询所有巡检命令Model失败"); } return null; }
public boolean save(BaseVo vo) { CmdCfgFile h3 = (CmdCfgFile) vo; StringBuffer sql = new StringBuffer( "insert into nms_vpncfg(id,timingId,ipaddress,fileName,content,backup_time,file_size,bkp_type) values("); sql.append(this.getNextID()); sql.append(","); sql.append(h3.getTimingId()); sql.append(",'"); sql.append(h3.getIpaddress()); sql.append("','"); sql.append(h3.getFileName()); sql.append("','"); sql.append(h3.getContent()); sql.append("','"); sql.append(h3.getBackupTime()); sql.append("',"); sql.append(h3.getFileSize()); sql.append(",'"); sql.append(h3.getBkpType()); sql.append("')"); return this.saveOrUpdate(sql.toString()); }