package com.gree.mall.manager.commonmapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gree.mall.manager.bean.count.*;
import com.gree.mall.manager.bean.exchange.GiftExchangeCodeBean;
import com.gree.mall.manager.bean.settle.DataBoardBean;
import com.gree.mall.manager.bean.settle.MonthSendWorkerBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface CountMapper {

    /**
     * 首页基础概况统计
     * @return
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    public CountBean countInfo(@Param("companyWechatIds") List<String> companyWechatIds);

    /**
     * 首页销售统计
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    public CountOrderBean countSaleOrder(@Param("startTime") String startTime,
                                         @Param("endTime") String endTime,
                                         @Param("workOrderType") String workOrderType,
                                         @Param("companyWechatIds") List<String> companyWechatIds,
                                         @Param("websitIds") List<String> websitIds);

    /**
     * 商品销量排行
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    public List<GoodsRankBean> countGoodsRank(@Param("startTime") String startTime,
                                              @Param("endTime") String endTime,
                                              @Param("companyWechatIds") List<String> companyWechatIds,
                                              @Param("websitIds") List<String> websitIds);


    //二手商城 - 累计售出商品数量，已售中商品数量，待发货订单数量，维权中订单数量，今日订单数，昨日订单数，今日收益，昨日收益
    public EsCountBean countEsInfo(@Param("companyWechatId") String companyWechatId);
    //二手商城-商品排行
    public IPage<EsGoodsRankBean> countEsGoodsRank(IPage page, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("companyWechatId") String companyWechatId);
    //二手商城--销售订单统计
    CountOrderBean countEsSaleOrder(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("companyWechatId") String companyWechatId);



    /**
     * 今日昨日访问量
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    public Integer countVisit(@Param("startTime") String startTime, @Param("endTime") String endTime,@Param("companyWechatIds") List<String> companyWechatIds);


    /**
     * 师傅的销售金额统计(外部接口结算用)
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    public List<Map<String,Object>> countWorkAmount(@Param("startTime") String startTime, @Param("endTime") String endTime,@Param("companyWechatIds") List<String> companyWechatIds);

    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    public Map<String,Object> countWebsitAmount(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("websitNumbers") List<String> websitNumbers);


    /**
     *  优惠券统计列表
     */
    @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
    public IPage<GiftExchangeCodeBean> queryExchangeCodeCountList(IPage page,@Param("keyword") String keyword,@Param("adminWebsitId") String adminWebsitId,@Param("companyWechatIds") List<String> companyWechatIds);


    DataBoardBean countTotalSettleExpense(@Param("companyWechatId") String companyWechatId, @Param("websitId") String websitId);

    DataBoardBean countTotalSettleSend(@Param("companyWechatId") String companyWechatId, @Param("websitId") String websitId);

    DataBoardBean countTotalSettleExpenseItem(@Param("companyWechatId") String companyWechatId, @Param("websitId") String websitId);

    DataBoardBean countTotalSettleSendItemAmount(@Param("companyWechatId") String companyWechatId, @Param("websitId") String websitId);

    DataBoardBean countTotalSettleSendItemCount(@Param("companyWechatId") String companyWechatId, @Param("websitId") String websitId, @Param("categoryName") String categoryName);

    List<MonthSendWorkerBean> monthSendData(@Param("companyWechatId") String companyWechatId, @Param("startMonth") String startMonth, @Param("endMonth") String endMonth);
}
