public class AssetFileQueueFixedDAOImpl extends JdbcDaoSupport implements AssetFileQueueDAO{
private final static String SELECT="SELECT ID,REGION,IP,FILE_SIZE,OLD_FILE_NAME,NEW_FILE_NAME,FILE_PATH,TEMP_TABLE_NAME,UP_DATE,TOTAL_ASSET,FAILURE_REASON,STATUS FROM ASSET_FILE_QUEUE"; /** *//** * 保存 */ public void save(final FileAttributeVO vo){ String sql="INSERT INTO ASSET_FILE_QUEUE(REGION,IP,FILE_SIZE,OLD_FILE_NAME,NEW_FILE_NAME,FILE_PATH,TEMP_TABLE_NAME,UP_DATE,STATUS) VALUES(?,?,?,?,?,?,?,sysdate,?)"; getJdbcTemplate().update(sql,new PreparedStatementSetter(){
public void setValues(PreparedStatement ps) throws SQLException{ int i=1; ps.setString(i++,vo.getRegion()); ps.setString(i++,vo.getIP()); ps.setLong(i++,vo.getFileSize().longValue()); ps.setString(i++,vo.getOldFileName()); ps.setString(i++,vo.getNewFileName()); ps.setString(i++,vo.getFilePath()); ps.setString(i++,vo.getTempTabelName()); ps.setString(i++,vo.getStatus()); } }); }
/** *//** * 查询 */ public List listFilesByStatus(final String status){ String sql=SELECT + " WHERE STATUS=? AND ROWNUM<=10 ORDER BY ID"; return (List)getJdbcTemplate().query(sql,new PreparedStatementSetter(){
public void setValues(PreparedStatement ps) throws SQLException{ ps.setString(1,status); }
// return result; },new ResultSetExtractor(){
List result=new ArrayList();
public Object extractData(ResultSet rs) throws SQLException,DataAccessException{ while(rs.next()){ FileAttributeVO vo=new FileAttributeVO(); int i=1; vo.setId(new Long(rs.getLong(i++))); vo.setRegion(rs.getString(i++)); vo.setIP(rs.getString(i++)); vo.setFileSize(new Long(rs.getLong(i++))); vo.setOldFileName(rs.getString(i++)); vo.setNewFileName(rs.getString(i++)); vo.setFilePath(rs.getString(i++)); vo.setTempTabelName(rs.getString(i++)); vo.setUpDate(rs.getString(i++)); vo.setTotalAsset(new Integer(rs.getInt(i++))); vo.setFailureReason(rs.getString(i++)); vo.setStatus(rs.getString(i++)); result.add(vo); } return result;
} }); }
/** *//** * 更新 */ public void update(final FileAttributeVO vo){ String sql="UPDATE ASSET_FILE_QUEUE SET FAILURE_REASON=?,STATUS=?,TOTAL_ASSET=? where id=?"; getJdbcTemplate().update(sql,new PreparedStatementSetter(){
public void setValues(PreparedStatement ps) throws SQLException{ int i=1; ps.setString(i++,StringUtils.trim(vo.getFailureReason())+""); ps.setString(i++,vo.getStatus()); long total=vo.getTotalAsset()==null?0:vo.getTotalAsset().longValue(); ps.setLong(i++,total); ps.setLong(i++,vo.getId().longValue()); } }); }
}
posted on 2005-12-29 13:44 jacky 阅读(498) 评论(0) 编辑 收藏 所属分类: Open source
| |
27 | 28 | 29 | 30 | 31 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
常用链接
留言簿(10)
随笔档案
文章分类
文章档案
相册
收藏夹
java
搜索
最新评论
|
|