package com.gree.mall.manager.commonmapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gree.mall.manager.bean.count.CountBean;
import com.gree.mall.manager.bean.count.CountOrderBean;
import com.gree.mall.manager.bean.count.GoodsRankBean;
import com.gree.mall.manager.bean.exchange.GiftExchangeCodeBean;
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("companyIds") List<String> companyIds,
                               @Param("adminWebsitIds") List<String> adminWebsitIds);

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

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

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


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

    @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("companyIds") List<String> companyIds);


}
