/**
 * @(#)file    DeptCodeManager.java
 * @(#)author  chj
 * @(#)version 1.0
 * @(#)date    2014-06-24
 * @(#)since   JDK1.6
 *
 * Copyright (c) www.udapsoft.co.kr, Inc.
 */
package kr.co.udapsoft.common.code;



import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.search.Search;
import kr.co.hsnc.common.sql.search.SearchImpl;
import kr.co.hsnc.common.sql.util.RowSetUtility;
import kr.co.hsnc.common.util.ValueObject;


/**
* 분류코드/품목코드 DB 접근 Beans.
*
* @version 1.0 
*/
public class DeptCodeManager {

    public static String getDeptName(String dept_cd) throws Exception {

        DeptCodeManager deptCodeManager = new DeptCodeManager();
        return deptCodeManager.getDeptValueObject(dept_cd).get("DEPT_NM");
    }

    public static String getDeptShortName(String dept_cd) throws Exception {

        DeptCodeManager deptCodeManager = new DeptCodeManager();
        return deptCodeManager.getDeptValueObject(dept_cd).get("DEPT_INI");
    }

    public ValueObject getDeptValueObject(String dept_cd) throws Exception {

        String sqlstr = " SELECT   DEPT_CD, DEPT_NM, DEPT_INI "
                      + " FROM     ACZ10100V "
                      + " WHERE    DEPT_CD = ? ";

        Search search = new SearchImpl();
        search.setStatement(sqlstr);
        search.addParameter(dept_cd);
        
        RowSet rowSet = search.execute();
        
        ValueObject valueObject = new ValueObject();
        
        if( rowSet != null && rowSet.size() > 0 )
            valueObject = RowSetUtility.getValueObject(rowSet.getRow(0));
    
        return valueObject;
    }


}
