package cn.cecep.talroad.mapper;

import cn.cecep.talroad.domain.*;
import cn.cecep.talroad.vo.*;
import cn.cecep.talroad.vo.analysis.FactoryOutletVo;
import cn.cecep.talroad.vo.analysis.PermitEmissionsFactoryVO;
import cn.cecep.talroad.vo.homepage.*;
import cn.cecep.talroad.vo.query.BStatTablepPwxkWaterQuery;
import cn.cecep.talroad.vo.query.EffectiveMonitoringRateQuery;
import cn.cecep.talroad.vo.query.PcFactoryQuery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * 企业基本信息Mapper接口
 *
 * @author szhpt
 * @date 2023-01-11*/
@Mapper
public interface PcFactoryMapper extends BaseMapper<PcFactory>
{
    List<PcFactoryVo> selectPcFactoryVoList(@Param("query") PcFactoryQuery query,@Param("str")  String str,@Param("regionCodes")List<String> regionCodes);

    HpmCompanyOverviewVo selectCompanyOverview(@Param("industry") String industry,@Param("regionCodes")List<String> regionCodes);

    HpmCompanyOverviewVo selectOutletOverview(@Param("industry") String industry,@Param("regionCodes")List<String> regionCodes);

    HpmMeriRatingOverviewVo selectMeritRatingOverview(@Param("industry") String industry,@Param("regionCodes")List<String> regionCodes);

    HpmEnvironmentOverviewVo selectOnvironmentOverview(@Param("industry") String industry,@Param("regionCodes")List<String> regionCodes);

    HpmEmissionTrackingOverviewVo selectGasEmissionTrackingOverview(@Param("emissionType")String emissionType,@Param("regionCodes")List<String> regionCodes);

    HpmEmissionTrackingOverviewVo selectWaterEmissionTrackingOverview(@Param("emissionType")String emissionType,@Param("regionCodes")List<String> regionCodes);

    List<ImportPollutionDischargeVo> selectImportPollutionDischarge(@Param("regionCodes") List<String> regionCodes);

    EnvironmentCreditPropVo selectProportionOfEcologicalEnvironmentCredit();

    List<PcFactoryVo> selectPcFactoryVoPage(@Param("page") Page<PcFactoryVo> page, @Param("query") PcFactoryQuery query,@Param("str") String str
            ,@Param("regionCodes")List<String> regionCodes);

    List<IndustryEmissionTrackingOverviewVo> selectIndustryEmissionTrackingOverviewVo(@Param("industry") String industry, @Param("emissionType") String emissionType);


    List<IndustryPollutantEmissionsTop10Vo> selectTop10CompaniesWithPollutantEmissionsInTheIndustry(@Param("industry") String industry, @Param("pollutantType") String pollutantType, @Param("regionCodes")List<String> regionCodes);

    List<Map<String, Object>> selectEmissionsByCompany(@Param("pollutantType") String pollutantType, @Param("groupByIndustry") boolean groupByIndustry);

    PcFactory selectPcFactoryById(String id);

    List<PcFactory> selectPcFactory();

    /**
     * 查询排污许可在有效期内的企业列表
     * @return
     */
    List<PermitEmissionsFactoryVO> selectPermitEmissionsFactoryList();

    HpmCompanyOverviewVo selectWaterRainwaterOutlet(@Param("industry") String industry,@Param("regionCodes")List<String> regionCodes);

    void updateScore(@Param("id") String id, @Param("score") Integer score);

    void updateScoreBatch(List<PcFactory> list);

    /**
     * 根据 factoryIds 查询七个数据源是否有站点接入
     *
     * @param factoryIds
     * @return
     */
    List<PcAdslFactory> selectSourceIsHaveDataByFacIds(@Param("factoryIds") Set<String> factoryIds);

    List<PcFactory> selectRegulateBusinesses();

    OverviewOnlineMonitorsVo overviewOnlineMonitors(@Param("regionCodes") List<String> regionCodes);

    MonitoringPointWarningVo gasMonitoringPointWarning(@Param("regionCodes") List<String> regionCodes);

    MonitoringPointWarningVo waterMonitoringPointWarning(@Param("regionCodes") List<String> regionCodes);

    List<MonitoringPointWarningDetailsVo> monitoringPointWarningDetails(Page<MonitoringPointWarningDetailsVo> page, @Param("regionCodes") List<String> regionCodes);

    List<EnterpriseIssuesTopVo> enterpriseIssuesTop(@Param("regionCodes") List<String> regionCodes);

    List<SEnvWaterMonReal> effectiveMonitoringRate(EffectiveMonitoringRateQuery query);

    List<SEnvGasMonReal> gasEffectiveMonitoringRate(EffectiveMonitoringRateQuery query);

    List<RegionalOnlineMonitoringVo> numberMonitoringPoints(EffectiveMonitoringRateQuery query);

    /**
     * @param query
     * @return
     */
    List<RegionalOnlineMonitoringVo> monitoringRate(EffectiveMonitoringRateQuery query);

    List<RegionalOnlineMonitoringVo> excessRate(EffectiveMonitoringRateQuery query);

    List<PcFactory> selectMajorPollutantCategory();

    List<String> selectPcFactoryId();

    FactoryOutletVo selectByFactoryAndOutletId(@Param("factoryId") String factoryId, @Param("outletId") String outletId);

    SEnvGasMonReal gasEffectiveMonitoringRates(EffectiveMonitoringRateQuery query);

    SEnvWaterMonReal effectiveMonitoringRates(EffectiveMonitoringRateQuery query);

    PcFactoryLicensingStatusVo factoryLicensingStatus();

    List<PcCountryLicensingStatusVo> countryLicensingStatus();

    int updateBatchCoordinate(List<PcFactory> pcFactoryList);

    void selectPwxkWaterTreatmentLine(@Param("page") Page<BStatTablePwxkWaterTreatmentLine> page,
                                      @Param("query")BStatTablepPwxkWaterQuery query);

    List<String> selectId(@Param("page") Page<String> page,@Param("map") Map<String, List<String>> labelMap,
                          @Param("factoryName") String factoryName);


    List<BMainEmissionPollutionAirVo.IndustryRank> selectAirEmissionIndustryRank(@Param("dataSource") String dataSource, @Param("regionCodes") List<String> regionCodes);

    List<BMainEmissionPollutionWaterVo.IndustryRank> selectWaterEmissionIndustryRank(@Param("dataSource") String dataSource, @Param("regionCodes") List<String> regionCodes);
}
