package digital.laboratory.platform.reagent.service.impl;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.reagent.entity.ReagentConsumables;
import digital.laboratory.platform.reagent.mapper.ReagentConsumablesMapper;
import digital.laboratory.platform.reagent.service.ReagentConsumablesService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * (试剂耗材类)服务实现类
 *
 * @author Zhang Xiaolong created at  2023-03-10
 * @describe (试剂耗材类) 服务实现类
 */
@Service
public class ReagentConsumablesServiceImpl extends ServiceImpl<ReagentConsumablesMapper, ReagentConsumables> implements ReagentConsumablesService {

    @Autowired
    private ReagentConsumablesService reagentConsumablesService;
    @Override
    public ReagentConsumables addReagentConsumables(Object object){

        ReagentConsumables reagentConsumables = new ReagentConsumables();

        BeanUtils.copyProperties(object,reagentConsumables);

        if (!(reagentConsumablesService.save(reagentConsumables))){

            throw  new RuntimeException(String.format("系统错误，试剂耗材目录更新失败"));
        }

        return reagentConsumables;
    }

}
