package core.stlmes.server.sale.dao.fund;

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

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import com.steering.comm.db.DBCommon;
import core.stlmes.server.sale.dbhelp.DbTrans;
import core.stlmes.server.sale.po.SlmBalanceInfoBean;
import core.stlmes.server.sale.po.fund.SelFundCustAccountBean;
import core.stlmes.server.sale.po.fund.SelFundCustFundInoutBean;
import core.stlmes.server.sale.po.fund.SelFundCustFundInoutBean;

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

	public List<SelFundCustFundInoutBean> getSelFundCustFundInOutByBalanceSubjectAndBuyerCode(
			String balancesubject, String buyerCode) throws SQLException
	{
		String sqlConditio = super.getSqlCondition(balancesubject, buyerCode);
		return query(sqlConditio);
	}

	public CoreReturnObject insert(SelFundCustFundInoutBean bean)
			throws java.sql.SQLException,java.lang.Exception
	{
		CoreReturnObject cro = new CoreReturnObject();
		String sqlIn = " insert into sel_fund_cust_fundinout"
				+ "(BUSISEQ, BALANCESUBJECT,BUYERCODE,INOUTMONEY,"
				+ "FUNDTYPE,BILLNO,ISVALID,REMARK,"
				+ "IMPORTOR,IMPORTTIME, LEAVEMONEY,INOUTTIME) " + "values("
				+ " sys_guid(),?,?,?,?,?,?,?,?,sysdate" + ",?,?) ";
		Object[] obj = new Object[]
		{ bean.getBalancesubject(), bean.getBuyercode(), bean.getInoutmoney(),
				bean.getFundtype(), bean.getBillno(), bean.getIsvalid(),
				bean.getRemark(), bean.getImportor(), bean.getLeavemoney(),
				bean.getInouttime() };
		String sql = super.getPreparedSQL(sqlIn, obj);
		cro = super.ExcuteNonQueryIgnoreTrans(sql);
		return cro;
	}
}
