package com.ho.business.mapper;


import com.ho.business.entity.EarningsCalculate;
import com.ho.business.entity.EarningsCalculateSub;
import com.ho.business.entity.MonFreezeTotal;
import com.ho.business.vo.RegionData;
import com.ho.business.vo.req.bigScreen.CommonBigScreenReq;
import com.ho.business.vo.req.carbin.EarningsCalculateReq;
import com.ho.business.vo.resp.profit.DayProfitType;
import com.ho.business.vo.resp.profit.GroupProfitType;
import com.ho.business.vo.resp.profit.StationProfitType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
* @author xwz
* @description 针对表【earnings_calculate】的数据库操作Mapper
* @createDate 2023-09-26
* @Entity com.ho.business.entity.EarningsCalculate
*/
@Mapper
public interface EarningsCalculateMapper {

    int insertSelective(EarningsCalculate record);

    int deleteByDay(@Param("day") String day, @Param("typeList") List<Integer> typeList);

    int insertBatch(List<EarningsCalculate> list);
    // 类型是传入多个
    //List<EarningsCalculate> selectList(@Param("stationId") Integer stationId, @Param("typeList") List<Integer> typeList, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
    List<EarningsCalculate> selectList(@Param("ec") EarningsCalculateReq earningsCalculateReq);

    /**
     * 直接汇总后的尖峰平谷
     * @param earningsCalculateReq
     * @return
     */
    List<EarningsCalculate> totalList(@Param("ec") EarningsCalculateReq earningsCalculateReq);

    /**
     * 按照每天汇总后尖峰平谷
     * @param earningsCalculateReq
     * @return
     */
    List<EarningsCalculate> totalListByDay(@Param("ec") EarningsCalculateReq earningsCalculateReq);

    public List<EarningsCalculateSub> queryElecTemplateSubByStationId(@Param("stationId")Integer stationId, @Param("templateType")Integer templateType,@Param("date")String date,@Param("elecType")Integer elecType);

    public List<EarningsCalculateSub> queryElecRateTemplateSubByStationId(@Param("stationId")Integer stationId, @Param("templateType")Integer templateType,@Param("date")String date);

    public Integer getSrcIdByStationId(@Param("stationId")Integer stationId, @Param("deviceType")String deviceType);

    public Double getColCount(@Param("stationId")Integer stationId, @Param("col")String col);

    public MonFreezeTotal queryData(@Param("stationId")Integer stationId,@Param("month")String month);

    public void batchInsertData(List<MonFreezeTotal> list);

    BigDecimal selectSumIncomeByStationId(@Param("type")Integer type,@Param("stationId")Integer stationId, @Param("beginTime") String beginTime, @Param("endTime") String endTime);

    /**
     * 根据区县名称查询当前电站所在的省市区
     * @param district
     * @return
     */
    RegionData queryRegionDataByDistrict(@Param("district")String district,@Param("city")String city,@Param("province")String province);


    int deleteByStationId(@Param("day") String day,@Param("stationId") Integer stationId, @Param("typeList") List<Integer> typeList);

    List<GroupProfitType> getGroupProfit(@Param("beginTime")String beginTime, @Param("endTime")String endTime, @Param("groupId")Integer groupId);

    List<StationProfitType> getStationProfit(@Param("beginTime")String beginTime, @Param("endTime")String endTime, @Param("groupId")Integer groupId);

    List<DayProfitType> getDayProfit(@Param("beginTime")String beginTime, @Param("endTime")String endTime, @Param("groupId")Integer groupId);

    String getFirstTime();

    List<DayProfitType> getProfit(@Param("beginTime")String begin, @Param("endTime")String end, @Param("groupId")Integer groupId);

    List<DayProfitType> getEarningsByParam(CommonBigScreenReq req);
}
