package com.crm.manager.dao.mapper;

import com.crm.rely.backend.core.dto.sales.SalesPerformanceDto;
import com.crm.rely.backend.core.entity.base.BaseIbReportListEntity;
import com.crm.rely.backend.core.entity.sales.SalesPerformanceListEntity;
import com.crm.rely.backend.core.pojo.view.TradeSalesPerformanceView;
import org.apache.ibatis.annotations.Param;

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

public interface SalesPerformanceMapper {

    List<SalesPerformanceDto> getSalesDepositSum(@Param("startDate") Date startDate, @Param("stamp") String stamp,
                                                 @Param("leaderId") Long leaderId,
                                                 @Param("addIbNo") List<String> addIbNo,
                                                 @Param("excludeIbNo") List<String> excludeIbNo);

    List<SalesPerformanceDto> getSalesWithdrawSum(@Param("startDate") Date startDate, @Param("stamp") String stamp,
                                                  @Param("leaderId") Long leaderId,
                                                  @Param("addIbNo") List<String> addIbNo,
                                                  @Param("excludeIbNo") List<String> excludeIbNo);

    List<SalesPerformanceDto> getSalesAddCustomSum(@Param("startDate") Date startDate, @Param("stamp") String stamp,
                                                   @Param("leaderId") Long leaderId,
                                                   @Param("addIbNo") List<String> addIbNo,
                                                   @Param("excludeIbNo") List<String> excludeIbNo);

    List<SalesPerformanceDto> getSalesRealCustomSum(@Param("startDate") Date startDate, @Param("stamp") String stamp,
                                                    @Param("leaderId") Long leaderId,
                                                    @Param("addIbNo") List<String> addIbNo,
                                                    @Param("excludeIbNo") List<String> excludeIbNo);

    Integer countSearch(BaseIbReportListEntity entity);

    List<TradeSalesPerformanceView> pageSearch(SalesPerformanceListEntity entity);

    TradeSalesPerformanceView sumSearch(BaseIbReportListEntity entity);

    List<TradeSalesPerformanceView> salesPerformanceList(SalesPerformanceListEntity entity);

    List<TradeSalesPerformanceView> findAllSalesByStamp(SalesPerformanceListEntity entity);

    void deleteSalesPerformanceByDate(@Param("startDate") Date startDate, @Param("salesNo") String salesNo);

    List<SalesPerformanceDto> getIbSalesDepositSum(@Param("startDate") Date startDate,
                                                   @Param("ibNoList") List<String> ibNoList);

    List<SalesPerformanceDto> getIbSalesWithdrawSum(@Param("startDate") Date startDate,
                                                    @Param("ibNoList") List<String> ibNoList);

    List<SalesPerformanceDto> getIbSalesRealCustomSum(@Param("startDate") Date startDate,
                                                      @Param("ibNoList") List<String> ibNoList);

    List<SalesPerformanceDto> getIbSalesAddCustomSum(@Param("startDate") Date startDate,
                                                     @Param("ibNoList") List<String> ibNoList);

    Date getFirstDate();
}
