class PageDataJdbcDaoImpl implements PageDataJdbcDao {

	@Override
	public void batchSave(Integer pageId, List<PageDataItem> allData) {
		jdbcTemplate.batchUpdate(SQL_INSERT_PAGE_DATA, new BatchPreparedStatementSetter() {

			@Override
			public int getBatchSize() {
				return allData.size();
			}

			@Override
			public void setValues(PreparedStatement ps, int index)
					throws SQLException {
				PageDataItem each = allData.get(index);
				ps.setString(1, each.getId());
				ps.setInt(2, pageId);
				ps.setString(3, each.getName());
				ps.setString(4, each.getType());
				ps.setString(5, each.getValue());
				ps.setString(6, each.getParentId());
				// seq 是从1开始的，是全页面内排序
				ps.setInt(7, index+1);
			}
			
		});

	}

}