package weaver.mfbdt.util;

import jdk.nashorn.internal.ir.ReturnNode;
import weaver.conn.RecordSet;
import weaver.general.Util;

import java.util.HashMap;
import java.util.Map;

/**
 * 铭沣工具类
 *
 * @author wangj
 * @version 1.00版本
 * @Date 2023/9/19
 */

public class MfUtil {
    public static Map<String, String> getUserInfo(String userid) {
        Map<String, String> map = new HashMap<>(100);
        RecordSet rs = new RecordSet();
        String sql = "select workcode,subcompanyid1,departmentid,jobtitle from hrmresource where id = ?";
        rs.executeQuery(sql, userid);
        while (rs.next()) {
            String gsmc = Util.null2String(rs.getString("subcompanyid1"));
            String szzw = Util.null2String(rs.getString("jobtitle"));
            String szbm = Util.null2String(rs.getString("departmentid"));
            String ygbh = Util.null2String(rs.getString("workcode"));

            map.put("gsmc", gsmc);
            map.put("szzw", szzw);
            map.put("szbm", szbm);
            map.put("ygbh", ygbh);
        }
        return map;
    }

    public static String getWorkflowname(String wfid){
        String wfname = "";
        RecordSet rs = new RecordSet();
        String sql = "select workflowname from workflow_base where id = ?";
        rs.executeQuery(sql, wfid);
        while (rs.next()){
            wfname = Util.null2String(rs.getString("workflowname"));
        }
        return wfname;
    }
}
