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

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.nantian.cloud.jljc.entity.EpcEnergyAccuracyAnalysis;
import com.nantian.cloud.jljc.entity.EpcEnergyAccuracyAnalysisInfo;
import com.nantian.cloud.jljc.mapper.EpcEnergyAccuracyAnalysisInfoMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nantian.cloud.jljc.service.EpcEnergyAccuracyAnalysisInfoService;
import com.nantian.cloud.jljc.service.EpcEnergyAccuracyAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 企业能耗准确性分析详细信息表 服务实现类
 * @author stz
 * @since 2020-12-01
 */
@Service("epcEnergyAccuracyAnalysisInfoService")
public class EpcEnergyAccuracyAnalysisInfoServiceImpl extends ServiceImpl<EpcEnergyAccuracyAnalysisInfoMapper, EpcEnergyAccuracyAnalysisInfo> implements EpcEnergyAccuracyAnalysisInfoService {

    @Autowired
    private EpcEnergyAccuracyAnalysisService epcEnergyAccuracyAnalysisService;

    @Override
    public List<EpcEnergyAccuracyAnalysisInfo> getAnalysisInfoList(String year, String enterpriseCode, String dataTable) {
        EpcEnergyAccuracyAnalysis q = new EpcEnergyAccuracyAnalysis();
        q.setYear(year);
        q.setDelFlag("1");
        q.setEpc(enterpriseCode);
        EpcEnergyAccuracyAnalysis analysis = epcEnergyAccuracyAnalysisService.getOne(Wrappers.query(q));
        EpcEnergyAccuracyAnalysisInfo q2 = new EpcEnergyAccuracyAnalysisInfo();
        q2.setAbnormalVolatilityId(analysis != null ? analysis.getId() : 0);
        q2.setDelFlag("1");
        q2.setDataTable(dataTable);
        return baseMapper.selectList(Wrappers.query(q2));
    }
}
