package com.crm.manager.dao.mapper;

import com.crm.rely.backend.core.dto.sales.SalesRewardActivityDto;
import com.crm.rely.backend.core.dto.sales.SalesRewardDto;
import com.crm.rely.backend.core.dto.sales.SalesRewardStatisticsDto;
import com.crm.rely.backend.core.entity.sales.SelesRewardActivityEntity;
import com.crm.rely.backend.core.entity.sales.SelesRewardStatisticsEntity;
import com.crm.rely.backend.core.pojo.table.SalesRewardStatisticsTable;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface SalesRewardActivityMapper {

    Integer countSalesRewardStatisticsByMonth(SelesRewardStatisticsEntity entity);

    List<SalesRewardStatisticsDto> salesRewardStatisticsByMonth(SelesRewardStatisticsEntity entity);

    Integer salesSubIndexRewardStatisticsByMonth(SelesRewardStatisticsEntity entity);

    List<SalesRewardDto> getCustomDepositAmount(@Param("nowTime") Date nowTime);

    List<SalesRewardDto> getAddCustomCountAmount(@Param("nowTime") Date nowTime);

    List<SalesRewardDto> salesRewardStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime);

    List<SalesRewardDto> salesTradeStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime,
                                              @Param("month") String month, @Param("lastMonth") String lastMonth);

    List<SalesRewardDto> salesRewardAmountStatistics(@Param("startTime") Date startTime,
                                                     @Param("endTime") Date endTime);

    List<SalesRewardDto> salesDeductionAmountStatistics(@Param("startTime") Date startTime,
                                                        @Param("endTime") Date endTime);

    List<SalesRewardStatisticsTable> salesRewardWeekStatistics(@Param("startTime") String startTime,
                                                               @Param("salesId") Long salesId);

    Integer countList(SelesRewardActivityEntity entity);

    List<SalesRewardActivityDto> pageList(SelesRewardActivityEntity entity);

    SalesRewardStatisticsTable findBySalesIdAndStatisticsDate(@Param("salesId") Long salesId,
                                                              @Param("statisticsDate") Date statisticsDate);

}
