package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi;

import cn.estsh.i3plus.ext.mes.api.busi.IProduceSnTravelExtService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesProduceSnExt;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesProduceSnTravelExt;
import cn.estsh.i3plus.ext.mes.pojo.repository.MesProduceSnTravelExtRepository;
import cn.estsh.i3plus.ext.mes.pojo.util.ConvertBeanExt;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.util.MesPcnConstWords;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wangjie
 * @version 1.0
 * @date 2021/1/13 9:28
 **/
@Slf4j
@Service
public class ProduceSnTravelExtService implements IProduceSnTravelExtService {

    @Autowired
    private MesProduceSnTravelExtRepository produceSnTravelExtRepository;

    @Override
    public MesProduceSnTravelExt insertProduceSnTravelExt(MesProduceSnExt produceSnExt) {
        MesProduceSnTravelExt produceSnTravelExt = new MesProduceSnTravelExt();
        BeanUtils.copyProperties(produceSnExt, produceSnTravelExt, MesPcnConstWords.ID);
        ConvertBean.serviceModelInitialize(produceSnTravelExt, produceSnExt.getModifyUser());
        new ConvertBeanExt(produceSnTravelExt).convertBean(produceSnTravelExt);
        return produceSnTravelExtRepository.insert(produceSnTravelExt);
    }

}
