package org.dromara.mall.statistics.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.mall.statistics.domain.vo.TransactionStatisticsVo;

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

/**
 * 统计Mapper接口
 *
 * @author pengles
 */
@Mapper
public interface MallStatisticsMapper {

    /**
     * 统计订单总数和总金额
     */
    Map<String, Object> countOrderStatistics(@Param("startDate") Date startDate, 
                                             @Param("endDate") Date endDate);

    /**
     * 统计已支付订单数和金额
     */
    Map<String, Object> countPaidOrderStatistics(@Param("startDate") Date startDate, 
                                                  @Param("endDate") Date endDate);

    /**
     * 统计退款金额
     */
    Long sumRefundAmount(@Param("startDate") Date startDate, 
                        @Param("endDate") Date endDate);

    /**
     * 统计每日订单数据
     */
    List<TransactionStatisticsVo.DailyStatisticsVo> countDailyOrderStatistics(@Param("startDate") Date startDate, 
                                                                               @Param("endDate") Date endDate);

    /**
     * 统计商品销售排行
     */
    List<TransactionStatisticsVo.ProductSalesRankVo> queryProductSalesRank(@Param("startDate") Date startDate, 
                                                                            @Param("endDate") Date endDate,
                                                                            @Param("limit") Integer limit);

}
