package com.steering.pss.qcm;

import java.util.ArrayList;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.db.DBCommon;

public class CoreComBaseProcessRStation extends DBCommon {

    public CoreReturnObject queryProcess() {
        return this.getDataBySqlID("CoreComBaseProessRStation.QueryProcess");
    }

    public CoreReturnObject queryStation(String processcode, String processcodec) {
        Object[] obj = new Object[] { processcode, processcodec, processcode,
                processcode , processcodec };
        return this.getDataBySqlID("CoreComBaseProessRStation.QueryStation",
                obj);
    }

    @SuppressWarnings("unchecked")
    public CoreReturnObject doSave(ArrayList<Object> parm, String processcode,
            String processcodec) {

        CoreReturnObject cro = new CoreReturnObject();
        ArrayList<Object> sqlIDList = new ArrayList<Object>();
        ArrayList<Object[]> parmlist = new ArrayList<Object[]>();
        sqlIDList.add(CoreXmlSqlParsersFactory
                .getSql("CoreComBaseProessRStation.DELETE"));
        parmlist.add(new Object[] { processcode,processcodec });
        if (parm.size() > 0) {
            for (int i = 0; i < parm.size(); i++) {
                ArrayList<Object> list = (ArrayList<Object>) parm.get(i);
                parmlist.add(list.toArray());
                sqlIDList.add(CoreXmlSqlParsersFactory
                        .getSql("CoreComBaseProessRStation.ADD"));
            }
        }
        cro = this.getDao("TgDao").ExcuteTransction(sqlIDList, parmlist);
        return cro;
    }

}
