package com.steering.pss.sale.order.qualityDesign.Dao.idao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.steering.pss.sale.order.qualityDesign.Dao.imp.DeptSelectDaoImp;

import CoreFS.SA08.CoreXmlSqlParsersFactory;

public class IDeptSelectDao implements DeptSelectDaoImp {
	/**
	 * 查询管理科室
	 * 
	 * @param con
	 *            连接字符串
	 * @param ordLnPk
	 *            合同行号
	 * @return String[]
	 * @throws SQLException
	 */
	public String[] getDept(Connection con, String ordLnPk) throws SQLException {
		String[] depts = null;
		String sql = CoreXmlSqlParsersFactory
				.getSql("IDeptSelectDao.getDeptByOrdLnPk");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, ordLnPk);
		ResultSet rs = ps.executeQuery();
		if (rs.next()) {
			depts = new String[2];
			depts[0] = rs.getString("DELIVY_DEPT_CODE");
			depts[1] = rs.getString("DELIVY_DEPT_DESC");
		}
		return depts;
	}
}
