package com.engine.htsc.wdzx.dao;

import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.htsc.GlobatTools.JAVATools;

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

/**
 * @author xf
 * @version 1.0.0
 * @ClassName DocbaseDao.java
 * @createTime 2021年11月08日 15:44:00
 */
public class DocbaseDao {

    public static Map<String,String> getdetail(String sysid,String bh){
        Map<String,String> retmap=new HashMap<>();

        String sql="select id,wj from uf_wdzx  where 1=1 ";

        sql+="and  instr(yqsyxt,'"+sysid+"')>0 ";
        Map<String,String> map=new HashMap<>();
        map.put("mbbh",bh);

        Map<String,Object> retrunmap= JAVATools.GetTableToMap(sql,map);
        if(retrunmap==null || retrunmap.size()<=0){
            return null;
        }
        retmap.put("id",Util.null2String(retrunmap.get("id")));
        retmap.put("wj",Util.null2String(retrunmap.get("wj")));
        //2022-03-17cmj
        String dtSql = "select * from uf_wdzx_dt1 where mainid = " +retrunmap.get("id") + " and zt = 1";
        RecordSet rs = new RecordSet();
        rs.execute(dtSql);
        if(rs.next()){
            retmap.put("bbh",Util.null2String(rs.getString("bbh")));
        }
        return retmap;
    }

    public static String getywcj(String value){
        String sql=" select id from uf_ywcj where 1=1";
        Map<String,String> map=new HashMap<>();
        map.put("ywcj",value);
        Map<String,Object> returnmap= JAVATools.GetTableToMap(sql,map);
        if(returnmap==null || returnmap.size()<=0){
            return "";
        }
        return Util.null2String(returnmap.get("id"));
    }
}
