package core.stlmes.server.sale.dao;

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

import com.steering.comm.tools.EntityTool;
import com.steering.comm.tools.SqlBuilder;

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

public class SlmOrderHeadTgDao extends BaseService
{
	private List<SlmOrderHeadTgBean> query(String sqlCondition)
			throws SQLException
	{
		List<SlmOrderHeadTgBean> list = null;
		String sqlStr = " select * from slm_order_head where 1 = 1 "
				+ "  and VALIDFLAG = '1'  ";
		sqlStr = sqlStr + sqlCondition;
		java.sql.ResultSet set = super.executeForResult(sqlStr);
		list = SlmOrderHeadTgBean.convertResultSetToBeanList(set);
		set.close();
		return list;
	}

	public SlmOrderHeadTgBean getSlmOrderHeadTgByOrdPk(String ordPk)
			throws SQLException
	{
		List<SlmOrderHeadTgBean> list = null;
		String sqlCondition = super.GetSqlConditionByStringValue("ORD_PK",
				ordPk);
		list = query(sqlCondition);
		if (list == null || list.size() == 0) return null;
		return list.get(0);

	}
	
	public SlmOrderHeadNewEntity getSlmOrderHeadTgByOrdPkNew(String ordPk,java.sql.Connection conn)
			throws SQLException
	{
		SqlBuilder b = null;
		b = new SqlBuilder("SlmBalanceQuery.getSlmOrderHeadTgByOrdPkNew");
		b.Fill(new String[]{ ordPk });
		SlmOrderHeadNewEntity list = EntityTool.getEntityBySqlNoClsCon(
				b.toString(), conn, SlmOrderHeadNewEntity.class);
		return list;
	}

}
