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.Blacklist;
import digital.laboratory.platform.reagent.mapper.BlacklistMapper;
import digital.laboratory.platform.reagent.service.BlacklistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * (试剂耗材黑名单)服务实现类
 *
 * @author Zhang Xiaolong created at  2023-03-10
 * @describe (试剂耗材黑名单) 服务实现类
 */
@Service
public class BlacklistServiceImpl extends ServiceImpl<BlacklistMapper, Blacklist> implements BlacklistService {

    @Autowired
    private BlacklistServiceImpl blacklistService;

    @Override
    public Blacklist addListById(String reagentConsumableId, String supplierId){

        Blacklist blacklist = new Blacklist();

        blacklist.setBlacklistId(IdWorker.getTimeId().toUpperCase());
        blacklist.setSupplierId(supplierId);
        blacklist.setResultsOfComplianceCheck(false);
        blacklist.setReagentConsumableId(reagentConsumableId);

        if (blacklistService.save(blacklist)){

            return blacklist;
        }else return null;
    }

}
