/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  org.apache.commons.logging.Log
 *  org.apache.commons.logging.LogFactory
 *  org.springframework.beans.factory.annotation.Autowired
 *  org.springframework.stereotype.Repository
 */
package com.hst.task.dao;

import com.hst.common.bo.FwhQytjSqlZxjg;
import com.hst.framework.common.HstSqlMapClientTemplate;
import com.hst.framework.constants.WebConstants;
import com.hst.framework.dao.BaseDao;
import com.hst.framework.util.HstEncodeUtil;
import com.hst.task.domain.QytjTaskSqlData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class QytjTaskDaoImp
implements BaseDao {
    public static Log _logger = LogFactory.getLog(QytjTaskDaoImp.class);
    @Autowired
    private HstSqlMapClientTemplate ssglSqlMapClientTemplate;

    public Map<String, Object> queryTaskList() throws Exception {
        HashMap map = new HashMap();
        List dataList = new ArrayList();
        this.ssglSqlMapClientTemplate.queryForObjectByCurr("pWebjkTaskQytjRwList", map, "dataList", "tjxlList");
        dataList = (List)map.get("dataList");
        List tjxlList = (List)map.get("tjxlList");
        HashMap<String, Object> res = new HashMap<String, Object>();
        res.put("taskList", dataList);
        res.put("tjxlList", tjxlList);
        return res;
    }

    public List<QytjTaskSqlData> querySqlScriptList(String tjxlDm) throws Exception {
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("tjxlDm", tjxlDm);
        ArrayList<QytjTaskSqlData> dataList = new ArrayList();
        this.ssglSqlMapClientTemplate.queryForObjectByCurr("pWebjkTaskQytjSql", "dataList", map);
        dataList = (List)map.get("dataList");
        return dataList;
    }

    public void insertFwhQytjSqlZxjg(FwhQytjSqlZxjg data) throws Exception {
        String databaseUsername = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("databaseUsername", databaseUsername);
        map.put("tjrwUuid", data.getTjrwUuid());
        data.setDatabaseUsername(databaseUsername);
        this.ssglSqlMapClientTemplate.insert("inisertFwhQytjSqlZxjg", data);
    }

    public void doQytjZxjgHxcl(String tjrwUuid) throws Exception {
        String databaseUsername = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("databaseUsername", databaseUsername);
        map.put("tjrwUuid", tjrwUuid);
        this.ssglSqlMapClientTemplate.queryForObject("pWebjkTaskQytjZxjgHxcl", map);
    }

    public void updateFwhQytjRwxxZt(String tjrwUuid, String zt, String errMess) {
        String databaseUsername = WebConstants.HST_PROP_MAP.get("hst.SCHEMA_TM");
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("databaseUsername", databaseUsername);
        map.put("tjrwUuid", tjrwUuid);
        map.put("zt", zt);
        map.put("errMess", HstEncodeUtil.GBK2ISO(errMess));
        this.ssglSqlMapClientTemplate.update("updateFwhQytjRwxxZt", map);
    }
}
