package core.stlmes.server.sale.dao;

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

import CoreFS.SA06.CoreReturnObject;
import core.stlmes.server.sale.dbhelp.DbTrans;
import core.stlmes.server.sale.po.SlmBalanceInfoBean;
import core.stlmes.server.sale.po.SlmOrderPriceListBean;

public class SlmOrderPriceDao extends BaseService
{
	private List<SlmOrderPriceListBean> query(String sqlCondition)
			throws SQLException
	{
		List<SlmOrderPriceListBean> list = null;
		String sqlStr = " select * from SLM_ORDER_PRICE_LIST  where 1 = 1 ";
		sqlStr = sqlStr + sqlCondition;
		java.sql.ResultSet set = super.executeForResult(sqlStr);
		list = SlmOrderPriceListBean.convertResultSetToBeanList(set);
		return list;
	}

	public List<SlmOrderPriceListBean> getSlmOrderPriceByPriceNo(String priceNo)
			throws SQLException
	{

		String sqlCondition = super.GetSqlConditionByStringValue("PRICE_NO",
				priceNo);
		return query(sqlCondition);
	}

	public SlmOrderPriceListBean getSlmOrderPriceByPriceNoAndOrderLnPk(
			String priceNo, String ORD_LN_PK) throws SQLException
	{

		String sqlCondition = super.GetSqlConditionByStringValue("PRICE_NO",
				priceNo);
		sqlCondition += super.GetSqlConditionByStringValue("ORD_LN_PK",
				ORD_LN_PK);
		List<SlmOrderPriceListBean> list = query(sqlCondition);
		if (list == null || list.size() == 0) return null;
		return list.get(0);

	}

}
