private static void updateTurnover( final int economicOperId, final OperInfo oper, final boolean isOperRemoving) { JdbcTemplate.getInstance() .call( new CallableStatementCreator() { public CallableStatement createCallableStatement(Connection con) throws SQLException { CallableStatement result = con.prepareCall( "{call ACC_UPDATE_ALL_REMN(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}"); result.setInt(1, economicOperId); result.setTimestamp(2, oper.keepDate); result.setShort(3, isOperRemoving ? (short) 1 : (short) 0); result.setObject(4, oper.fromId); result.setObject(5, oper.toId); result.setString(6, oper.baseDocType); result.setString(7, oper.baseDocNumber); result.setTimestamp(8, oper.baseDocDate); result.setString(9, oper.confirmDocType); result.setString(10, oper.confirmDocNumber); result.setTimestamp(11, oper.confirmDocDate); result.setString(12, oper.contractType); result.setString(13, oper.contractNumber); result.setTimestamp(14, oper.contractDate); result.setString(15, oper.specMark); return result; } }, new ArrayList<Object>()); }
private static OperInfo loadEconomicOper(int operId) { List<OperInfo> list = JdbcTemplate.getInstance() .query( "select keepdate, from_id, to_id, docbasetype, docbasenumber, docbasedate, doctype, docnumber, docdate, contracttype, contractnumber, contractdate, specmark from economicoper where id = ?", new Object[] {operId}, new RowMapper<OperInfo>() { public OperInfo mapRow(ResultSet rs, int rowNum) throws SQLException { OperInfo result = new OperInfo(); result.keepDate = rs.getTimestamp("keepdate"); result.fromId = (Integer) rs.getObject("from_id"); result.toId = (Integer) rs.getObject("to_id"); result.baseDocType = rs.getString("docbasetype"); result.baseDocNumber = rs.getString("docbasenumber"); result.baseDocDate = rs.getTimestamp("docbasedate"); result.confirmDocType = rs.getString("doctype"); result.confirmDocNumber = rs.getString("docnumber"); result.confirmDocDate = rs.getTimestamp("docdate"); result.contractType = rs.getString("contracttype"); result.contractNumber = rs.getString("contractnumber"); result.contractDate = rs.getTimestamp("contractdate"); result.specMark = rs.getString("specmark"); return result; } }); if (list.isEmpty()) throw new IllegalArgumentException(); return list.get(0); }