package com.utopiaindustries.dao.ctp;

import com.utopiaindustries.model.ctp.JobCardItem;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class JobCardItemRowMapper implements RowMapper<JobCardItem> {
	public JobCardItem mapRow( ResultSet rs, int rowNum ) throws SQLException {
		JobCardItem jobCardItem = new JobCardItem();
		jobCardItem.setId( rs.getLong( "id" ) );
		jobCardItem.setJobCardId( rs.getLong( "job_card_id" ) );
		jobCardItem.setItemId( rs.getLong( "item_id" ) );
		jobCardItem.setSku( rs.getString( "sku" ) );
		jobCardItem.setExpectedProduction( rs.getBigDecimal( "expected_production" ) );
		jobCardItem.setActualProduction( rs.getBigDecimal("actual_production" ) );
		jobCardItem.setTotalProduction( rs.getBigDecimal("total_production" ) );
		jobCardItem.setAccountId( rs.getLong("account_id" ) );
		jobCardItem.setLength( rs.getString("length" ) );
		jobCardItem.setWidth( rs.getString("width") ) ;
		jobCardItem.setGsm( rs.getString("gsm" ) );
		jobCardItem.setWtPly( rs.getString("wt_ply" ) );
		jobCardItem.setPly( rs.getString("ply" ) );
		return jobCardItem;
	}
}