package com.engine.htsc.lhhtsq.Serivce.impl;

import com.engine.core.impl.Service;
import com.engine.htsc.lhhtsq.Dao.LhhtsqOldToDataDao;
import com.engine.htsc.lhhtsq.Serivce.LhhtsqOldToDataService;
import com.engine.htsc.lhhtsq.enity.OtherDatavalue;
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 LhhtsqOldToData.java
 * @createTime 2021年12月14日 14:38:00
 */
public class LhhtsqOldToDataServiceImpl extends Service implements LhhtsqOldToDataService {

    @Override
    public String updatebase(OtherDatavalue otherDatavalue) {
        String lcbh= Util.null2String(otherDatavalue.getLcbh());
        String wfje=Util.null2String(otherDatavalue.getWfje());
        String yfje=Util.null2String(otherDatavalue.getYfje());
        String yfqsxx=Util.null2String(otherDatavalue.getYfqsxx());
        if("".equals(lcbh) || ("".equals(wfje) && "".equals(yfje) && "".equals(yfqsxx))){
            return JAVATools.Apiretrun("400","参数有误！");
        }
        String datatable=JAVATools.Getunnumbertotable("lhht");
        String pkey= LhhtsqOldToDataDao.getpkey(datatable,lcbh);
        if("".equals(pkey)){
            return JAVATools.Apiretrun("400","参数有误！");
        }
        Map<String,String> params=new HashMap<>();
        params.put("wfje",wfje);
        params.put("yfje",yfje);
        params.put("yfqsxx",yfqsxx);
        Map<String,String> pkeymap=new HashMap<>();
        pkeymap.put("id",pkey);
        JAVATools.SetCmdwritelog("修改数据Params：");
        JAVATools.SetCmdwritelog("datatable："+datatable+" params:"+params.toString()+" pkey:"+pkeymap.toString());
        JAVATools.Updatesql(params,datatable,pkeymap);
        return JAVATools.Apiretrun("200",pkey);
    }
}
