日期:2014-05-16 浏览次数:20876 次
"select * from (select t.* ,rownum row_num from PAY_PREPAYMENT_WT_SEND t where REMAIN_MONTH <> 0 order by id desc) a where a.row_num>" + start + " and a.row_num <= " + end;
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); PreparedStatement pstmt = null; try { conn.setAutoCommit(false); pstmt = conn.prepareStatement( "update PAY_PREPAYMENT_WT_SEND set REMAIN_MONTH = REMAIN_MONTH-1, LAST_UPDATE =?,COUNTNUM = COUNTNUM+1 WHERE id =?"); for (int i = 0; i < list.size(); i++) { CTSHWTPayMentEntity pe = (CTSHWTPayMentEntity) list.get(i); pstmt.setString(2, pe.getId()); pstmt.setTimestamp( 1, Timestamp.valueOf(fmt.format(pe.getLast_update()))); pstmt.addBatch(); } pstmt.executeBatch(); conn.commit(); } catch (SQLException e) { try { conn.rollback(); } catch (SQLException e1) { e1.printStackTrace(); } e.printStackTrace(); } finally { try { if (null != pstmt) pstmt.close(); } catch (SQLException e) { e.printStackTrace(); } }