package com.nantian.cloud.dbcapp.mapper.record;

import com.nantian.cloud.dbcapp.bean.TElectricityDataValue;
import com.nantian.cloud.dbcapp.bean.TEnergyStructure;
import com.nantian.cloud.dbcapp.bean.TUnitenergy2020;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.util.List;

@Mapper
public interface EnergyExceptionResultInfoMapper {

    List<TElectricityDataValue> selectElectricityDataValue(@Param("statDate") String statDate);

    TEnergyStructure selectEnergyStructure(@Param("recordCircle") String statDate,
                                           @Param("enterpriseId") String enterpriseId,
                                           @Param("dataCode") String dataCode);

    void insertEnergyExceptionResultInfo(@Param("enterpriseCode") String enterpriseCode,
                                         @Param("dataCode") String dataCode,
                                         @Param("quotaName") String quotaName,
                                         @Param("dataValue") double dataValue,
                                         @Param("quotaUnit") String quotaUnit,
                                         @Param("exceptionType") String exceptionType,
                                         @Param("statDate") String statDate,
                                         @Param("datumValue") double datumValue,
                                         @Param("operateDate") String operateDate);

    List<TUnitenergy2020> selectUnitenergy(@Param("recordCircle") String recordCircle,
                                           @Param("code") String code,
                                           @Param("energyTypeCode") String energyTypeCode,
                                           @Param("haltList") List<String> haltList);

    String selectNergyConsumeLevel(@Param("enterpriseId") String enterpriseId);

    void insertComprehensiveEnergyExceptionResult(@Param("enterpriseCode") String enterpriseCode,
                                                  @Param("quotaName") String quotaName,
                                                  @Param("dataValue") double dataValue,
                                                  @Param("quotaUnit") String quotaUnit,
                                                  @Param("exceptionType") String exceptionType,
                                                  @Param("recordCircle") String recordCircle,
                                                  @Param("energyConsumeLevel") String energyConsumeLevel,
                                                  @Param("operateDate") String operateDate);

    void deleteComprehensiveEnergyExceptionResult(@Param("quotaName") String quotaName, @Param("recordCircle") String recordCircle);

    // 更新单位产品能耗异常前先将之前的异常清空
    void deleteUnitComprehensiveEnergyExceptionResult(@Param("statDate") String statDate);

    /**
     * @Description: 单位产品能耗异常，高于限定值的20%
     * @Author: suixin
     * @Date: 2022/8/3
     * @Param: [statDate]
     */
    void insertUnitComprehensiveOvertop(String statDate);

    /**
     * @Description: 单位产品能耗异常，低于先进值的20%
     * @Author: suixin
     * @Date: 2022/8/3
     * @Param: [statDate]
     */
    void insertUnitComprehensiveUnder(String statDate);
}
