package com.yem.wm.es.Util;

import com.yem.wm.utils.RequestCmmp;
import com.yem.wm.utils.YEM;
import kd.bos.context.RequestContext;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author xwudd
 * @date 11:46
 * @Description
 **/
public class PurchaserInfo {
    public final static String materialCode = "mater_code";
    public final static String buyerCode = "buyer_code";//采购员码
    public final static String buyerName = "buyer_name";//采购员名称

    public static List<Map> buyerInfo(Map<String,Object> map,Long id){
        String sql = "select mater_code,buyer_code,buyer_name from VIEW_MATER_BUYER_WM ";
        long orgId = RequestContext.get().getOrgId();
        String material = (String)map.get(materialCode);//物料编码
        if(YEM.isEmpty(material)){
            return new ArrayList<>();
        }
        StringBuffer where = new StringBuffer(String.format("where %s = '%s'",materialCode,material));
        sql = sql + where;
        List<Map> fromCmmp = RequestCmmp.getFromCmmp(orgId, sql,id);
        return fromCmmp;
    }
}
