package com.cyksj.mapper.manage.statistics;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyksj.model.entity.RegisterOrderDon;
import com.cyksj.model.entity.StatisticsUserData;
import com.cyksj.model.excel.statistics.ExcelRealGoodsData;
import com.cyksj.model.excel.statistics.ExcelStreamingAccountData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

/*
 *项目名: netflix
 *文件名: StatisticsUserDataMapper
 *创建者: JavaZou
 *创建时间:2022/11/24 16:21
 */
public interface StatisticsUserDataMapper extends BaseMapper<StatisticsUserData> {
	@Select("select count(distinct unionid) from user where created_time between #{yesZeroDate} and #{thisZeroDate} and unionid != ''")
	Integer getNumOfNewUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);

	@Select("select count(distinct unionid) from user where update_time between #{yesZeroDate} and #{thisZeroDate} and unionid != ''")
	Integer getNumOfActiveUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);

	@Select("select count(*) from user where (login_phone != '' or email != '')")
	Integer getPcTotalOfUser();

	@Select("select count(*) from user where created_time between #{yesZeroDate} and #{thisZeroDate} and (login_phone != '' or email != '')")
	Integer getPcNumOfNewUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);

	@Select("select count(*) from user where update_time between #{yesZeroDate} and #{thisZeroDate} and (login_phone != '' or email != '')")
	Integer getPcNumOfActiveUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);

	@Select("select count(*) from user_distribute_shared where created_time between #{yesZeroDate} and #{thisZeroDate}")
	Integer getNumOfDistributeUserToday(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);

	ExcelStreamingAccountData getExportStreamingAccountData(@Param("goodsId") Long goodsId, @Param("isDis") Boolean isDis, @Param("isCode") Boolean isCode, @Param("start") String start, @Param("end") String end);

	Integer getTypeData(@Param("goodsId") Long goodsId, @Param("type") String type, @Param("start") String start, @Param("end") String end);

	ExcelRealGoodsData getExportGoodsDonDataBySkuId(@Param("skuId") Long skuId, @Param("start") String start, @Param("end") String end);

	List<RegisterOrderDon> getPlatformHasPaymentOrders(@Param("platform") String platform, @Param("start") String start, @Param("end") String end);
}
