package com.jeequan.jeepay.service.mapper;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jeequan.jeepay.core.entity.PayOrderCount;
import com.jeequan.jeepay.db.entity.StatsTrade;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * 交易数据统计表 Mapper 接口
 * </p>
 *
 * @author [mybatis plus generator]
 * @since 2022-12-20
 */
public interface StatsTradeMapper extends BaseMapper<StatsTrade> {

    List<StatsTrade> selectTradeStats(@Param("param") Map<String, Object> param);

    // 门店
    Long selectStoreTradeStatsCount(@Param("param") Map<String, Object> params);

    /**
     * 门店今日数据查询
     * @param params
     * @return
     */
    List<PayOrderCount> selectStoreTodayTradeStatsList(@Param("param") Map<String, Object> params);

    /**
     *门店非今日统计列表
     * @param params
     * @return
     */
    List<PayOrderCount> selectStoreStatsList(@Param("param") Map<String, Object> params);

    /**
     * 门店今日统计总计
     * @param params
     * @return
     */
    PayOrderCount selectTodayStats4Store(@Param("param") Map<String, Object> params);

    /**
     * 门店非今日统计总计
     * @param params
     * @return
     */
    PayOrderCount selectStats4Store(@Param("param") Map<String, Object> params);

    // 商户
    Long selectMchTodayTradeStatsCount(@Param("param") Map<String, Object> params);

    /**
     * 商户今日数据查询
     * @param params
     * @return
     */
    List<PayOrderCount> selectMchTodayTradeStatsList(@Param("param") Map<String, Object> params);

    /**
     *商户非今日统计列表
     * @param params
     * @return
     */
    List<PayOrderCount> selectMchStatsList(@Param("param") Map<String, Object> params);

    PayOrderCount selectTodayStats4Mch(@Param("param") Map<String, Object> params);

    PayOrderCount selectStats4Mch(@Param("param") Map<String, Object> params);

    // 服务商
    Long selectAgentTradeStatsCount(@Param("param") Map<String, Object> params);

    /**
     * 代理商今日数据查询
     * @param params
     * @return
     */
    List<PayOrderCount> selectAgentTodayTradeStatsList(@Param("param") Map<String, Object> params);

    List<PayOrderCount> selectAgentStatsList(@Param("param") Map<String, Object> params);

    PayOrderCount selectTodayStats4Agent(@Param("param") Map<String, Object> params);

    PayOrderCount selectStats4Agent(@Param("param") Map<String, Object> params);

    // 服务商
    Long selectIsvTradeStatsCount(@Param("param") Map<String, Object> params);

    List<PayOrderCount> selectIsvTodayTradeStatsList(@Param("param") Map<String, Object> params);

    /**
     * 服务商非今日统计列表
     * @param params
     * @return
     */
    List<PayOrderCount> selectIsvStatsList(@Param("param") Map<String, Object> params);

    /**
     *服务商今日统计总计
     * @param params
     * @return
     */
    PayOrderCount selectTodayStats4Isv(@Param("param") Map<String, Object> params);

    /**
     * 服务商非今日统计总计
     * @param params
     * @return
     */
    PayOrderCount selectStats4Isv(@Param("param") Map<String, Object> params);

    // 日交易统计
    JSONObject selectTodayPayCount(@Param("param") Map<String, Object> params);

    JSONObject selectPayDayCount(@Param("param") Map<String, Object> params);

    /**
     * 趋势图
     * @param paramMap
     * @return
     */
    List<PayOrderCount> selectOrderCount(@Param("param") Map<String, Object> paramMap);

    /**
     * 交易报表
     * @param params
     * @return
     */
    Long selectTransactionStatsCount(@Param("param") Map<String, Object> params);

    /**
     * 交易报表List
     * @param paramMap
     * @return
     */
    List<PayOrderCount> selectTransactionStatsList(@Param("param") Map<String, Object> paramMap);

    /**
     * 交易报表今日数据统计
     * @param params
     * @return
     */
    PayOrderCount selectTodayStats4Transaction(@Param("param") Map<String, Object> params);

    /**
     * 交易报表其他日期数据统计
     * @param params
     * @return
     */
    PayOrderCount selectStats4Transaction(@Param("param") Map<String, Object> params);

    /**
     *订单页数据统计
     * @param params
     * @return
     */
    PayOrderCount selectSumStats(@Param("param") Map<String, Object> params );

    /**
     * 商户统计数据
     * @param params
     * @return
     */
    List<PayOrderCount> selectMachTradeStatsList(@Param("param") Map<String, Object> params);
}
