package com.yunzhi.marketing.statistic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunzhi.marketing.statistic.entity.TsCustomerStatisticDaily;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 客户分析日统计表 小程序盘客工具客户分析 Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2019-11-08
 */
@Mapper
public interface TsCustomerStatisticDailyMapper extends BaseMapper<TsCustomerStatisticDaily> {
	
	/**
	 * 获取当天跟进客户数
	 * @param nowDate
	 * @return
	 */
	List<TsCustomerStatisticDaily> getFollowUpData(@Param("nowDate") LocalDateTime nowDate);
	
	/**
	 * 获取当天新增客户数
	 * @param nowDate
	 * @param status
	 * @return
	 */
	List<TsCustomerStatisticDaily> getNewCustomerData(@Param("nowDate") LocalDateTime nowDate, @Param("status") int status);
	
	/**
	 * 获取当天到访客户数
	 * @param nowDate
	 * @param checkin
	 * @return
	 */
	List<TsCustomerStatisticDaily> getVisiteCustomerData(@Param("nowDate") LocalDateTime nowDate, @Param("checkin") int checkin);
	
	/**
	 * 获取31天的统计数据
	 * @param customerType
	 * @param orgId
	 * @param nowDate
	 * @param beforeDate
	 * @param personId
	 * @param userId
	 * @return
	 */
	List<TsCustomerStatisticDaily> getDailyList(@Param("customerType") String customerType, @Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate, @Param("beforeDate") LocalDateTime beforeDate, @Param("personId") String personId,@Param("userId") Integer userId);
	
	int deleteNowDate(@Param("nowDate") LocalDateTime nowDate,@Param("customerType") String customerType);
}
