/**
 * @(#)file    ItemSectListBiz.java
 * @(#)author  pej
 * @(#)version 1.0
 * @(#)date    2007.06-13
 * @(#)since   JDK1.4.1
 *
 * Copyright (c) 2002-2003 www.hwenc.com, Inc.  
 * All rights reserved.
 * This software is the proprietary information of hwenc, Inc.
 */
package kr.co.udapsoft.ebid.buyer.sycs.common.biz;

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

import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

public class CommGongCodeListBiz extends Biz {

    public CommGongCodeListBiz(HandlerStorage storage) {

        super(storage);        
    }
    public void doBiz() throws Exception {

        RowSet rowSet = getItemSectList(params);
        storage.addRowSet("rsSectList", rowSet);
        
    }
	
    
    
    public RowSet getItemSectList(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        String sqlstr = "";
        
        
        try {
        	sqlstr += "SELECT A.ITEM_CD, A.KIND_MID, A.KIND_BIG, A.ITEM_NAME, A.DEPTH                 \n"
        		+  	  "  FROM                                                                         \n"
        		+  	  "      (SELECT ITEM_CD, KIND_BIG, KIND_MID, ITEM_NAME, DEPTH, PARENT_LEVEL      \n"
        		+  	  "         FROM OUT_ITEM                                                         \n"
        		+  	  "        WHERE DEPTH = 1                                                        \n"
        		+  	  "        UNION ALL                                                              \n"
        		+  	  "       SELECT ITEM_CD, KIND_BIG, KIND_MID, ITEM_NAME, DEPTH, PARENT_LEVEL      \n"
        		+  	  "         FROM OUT_ITEM                                                         \n"
        		+  	  "        WHERE DEPTH = 2) A                                                     \n"
        		+  	  " ORDER BY ITEM_CD                                                              \n";
        	
            search.setStatement(sqlstr);
            rowSet = search.execute();
            WAFLogger.debug(sqlstr.toString());
        }
        catch (WAFSQLException se) {
        	WAFLogger.error(this.getClass().getName() + " --> getUserName() : \n" + se.getMessage());
        	WAFLogger.error("SQL : " + search.getStatement());
        	WAFLogger.error(se);
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
	}
}
