package core.stlmes.server.sale.dao;

import java.sql.SQLException;
import java.util.List;

import CoreFS.SA06.CoreReturnObject;
import core.stlmes.server.sale.po.YdmZcBillMBean;
import core.stlmes.server.sale.po.YdmZcLoadVehicleBean;

public class YdmZcLoadVehicleDao extends BaseService
{
	private final String Bill_no = "Bill_no";

	private List<YdmZcLoadVehicleBean> query(String sqlCondition)
			throws SQLException
	{
		List<YdmZcLoadVehicleBean> list = null;
		String sqlStr = " select * from YDM_ZC_LOADVEHICLE where 1 = 1  and VALIDFLAG = '1' ";
		sqlStr = sqlStr + sqlCondition;
		java.sql.ResultSet rs = super.executeForResult(sqlStr);
		list = YdmZcLoadVehicleBean.convertResultSetToBeanList(rs);
		return list;
	}

	public List<YdmZcLoadVehicleBean> getYdmZcLoadVehicleByBillNo(String billno)
			throws SQLException
	{

		String sqlCondition = super.GetSqlConditionByStringValue(Bill_no,
				billno);
		return query(sqlCondition);
	}

	public YdmZcLoadVehicleBean getYdmZcLoadVehicleByLoadVehicleNo(
			String vehicleNo) throws SQLException
	{

		String sqlCondition = super.GetSqlConditionByStringValue(
				"LOADVEHICLE_NO", vehicleNo);
		List<YdmZcLoadVehicleBean> list = query(sqlCondition);
		if (list == null) return null;
		return list.get(0);
	}

}
