package com.nantian.cloud.dbcapp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nantian.cloud.dbcapp.entity.ConfigureDataCollectGenerate;
import com.nantian.cloud.dbcapp.mapper.record.ConfigureDataCollectGenerateMapper;
import com.nantian.cloud.dbcapp.service.ConfigureDataCollectGenerateService;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 采集配置项生成表 服务实现类
 * </p>
 *
 * @author suixin
 * @since 2022-05-04
 */
@Service
public class ConfigureDataCollectGenerateServiceImpl extends ServiceImpl<ConfigureDataCollectGenerateMapper, ConfigureDataCollectGenerate> implements ConfigureDataCollectGenerateService {

    @Override
    public List<Map<String, Object>> getGenerateList(String epc) {
        return this.baseMapper.getGenerateList(epc);
    }

    @Override
    public List<String> getDigestList(String epc) {
        return this.baseMapper.getDigestList(epc);
    }

    @Override
    public List<Long> getIdList(String epc) {
        return this.baseMapper.getIdList(epc);
    }

    @Override
    public boolean backUpGenerateData(ConfigureDataCollectGenerate configureDataCollectGenerate) {
        if (configureDataCollectGenerate.getMemorandumId() == null){
            configureDataCollectGenerate.setMemorandumId(configureDataCollectGenerate.getId());
        }
        configureDataCollectGenerate.setId(null);
        configureDataCollectGenerate.setMemorandumStatus(0);
        return save(configureDataCollectGenerate);
    }
}
