package com.huiju.estateagents.statistic.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huiju.estateagents.entity.TaBuilding;
import com.huiju.estateagents.entity.TaPersonBuilding;
import com.huiju.estateagents.excel.ActivityStatistics.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface TaActicityStaticMapper {

    Integer selectSharePersonNum(
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("buildingId") String buildingId,
            @Param("targetType") String targetType,
            @Param("orgId") Integer orgId,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId);

    Integer selectShareNum(@Param("startDate") LocalDateTime startDate,
                           @Param("endDate") LocalDateTime endDate,
                           @Param("buildingId") String buildingId,
                           @Param("targetType") String targetType,
                           @Param("orgId") Integer orgId,
                           @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
                           @Param("userId") Integer userId);

    Integer selectVisitPersonNum(@Param("startDate") LocalDateTime startDate,
                                 @Param("endDate") LocalDateTime endDate,
                                 @Param("buildingId") String buildingId,
                                 @Param("targetType") String targetType,
                                 @Param("orgId") Integer orgId,
                                 @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
                                 @Param("userId") Integer userId);

    Integer selectVisitNum(@Param("startDate") LocalDateTime startDate,
                           @Param("endDate") LocalDateTime endDate,
                           @Param("buildingId") String buildingId,
                           @Param("targetType") String targetType,
                           @Param("orgId") Integer orgId,
                           @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
                           @Param("userId") Integer userId);

    List<Map<String, Object>> selectShareCount(@Param("orgId") Integer orgId,
                                               @Param("startDate") LocalDateTime startDate,
                                               @Param("endDate") LocalDateTime endDate,
                                               @Param("buildingId") String buildingId,
                                               @Param("targetType") String targetType,
                                               @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
                                               @Param("userId") Integer userId );

    List<Map<String, Object>> selectSharePersonCount(@Param("orgId") Integer orgId,
                                                     @Param("startDate") LocalDateTime startDate,
                                                     @Param("endDate") LocalDateTime endDate,
                                                     @Param("buildingId") String buildingId,
                                                     @Param("targetType") String targetType,
                                                     @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
                                                     @Param("userId") Integer userId);

    List<Map<String, Object>> selectVisitCount(@Param("orgId") Integer orgId,
                                               @Param("startDate") LocalDateTime startDate,
                                               @Param("endDate") LocalDateTime endDate,
                                               @Param("buildingId") String buildingId,
                                               @Param("targetType") String targetType,
                                               @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);

    List<Map<String, Object>> selectVisitPersonCount(@Param("orgId") Integer orgId,
                                                     @Param("startDate") LocalDateTime startDate,
                                                     @Param("endDate") LocalDateTime endDate,
                                                     @Param("buildingId") String buildingId,
                                                     @Param("targetType") String targetType,
                                                     @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);

    List<Map<String, Object>> selectAddRegistCount(@Param("orgId") Integer orgId,
                                                   @Param("startDate") LocalDateTime startDate,
                                                   @Param("endDate") LocalDateTime endDate,
                                                   @Param("buildingId") String buildingId,
                                                   @Param("targetType") String targetType,
                                                   @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings);

    IPage<StatisicAttractUser> selectTableData(
            IPage<StatisicAttractUser> attractUserIPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("buildingId") String buildingId,
            @Param("targetType") String targetType,
            @Param("sortType") String sortType,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId );

    List<StatisicAttractUser> selectExportTableData(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("buildingId") String buildingId,
            @Param("targetType") String targetType,
            @Param("sortType") String sortType,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId );

    IPage<ActivityDetailShareRecord> selectActivityStatisDetail(
            IPage<ActivityDetailShareRecord> attractUserIPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("buildingId") String buildingId,
            @Param("targetType") String targetType,
            @Param("activityName") String activityName,
            @Param("sortType") String sortType,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    List<ActivityDetailShareRecord> selectActivityStatisDetailExport(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDate startDate,
            @Param("endDate") LocalDate endDate,
            @Param("buildingId") String buildingId,
            @Param("targetType") String targetType,
            @Param("activityName") String activityName,
            @Param("sortType") String sortType,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    IPage<SharePersonNum> selectActivitySharePersonNum(
            IPage<SharePersonNum> iPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("sharePersonType") String sharePersonType,
            @Param("sharePersonName") String sharePersonName,
            @Param("sharePhone") String sharePhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("sort") String sort,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    List<SharePersonNum> selectActivitySharePersonNumExport(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("sharePersonType") String sharePersonType,
            @Param("sharePersonName") String sharePersonName,
            @Param("sharePhone") String sharePhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("sort") String sort,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    IPage<ShareNum> selectActivityShareNum(
            IPage<ShareNum> iPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("sharePersonType") String sharePersonType,
            @Param("sharePersonName") String sharePersonName,
            @Param("sharePhone") String sharePhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("personId") String personId,
            @Param("buildingId") String buildingId,
            @Param("sort") String sort,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    List<ShareNum> selectActivityShareNumExport(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("sharePersonType") String sharePersonType,
            @Param("sharePersonName") String sharePersonName,
            @Param("sharePhone") String sharePhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("personId") String personId,
            @Param("buildingId") String buildingId,
            @Param("sort") String sort,
            @Param("colKey") String colKey,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    IPage<AddRegistNum> selectActivityAddRegistNum(
            IPage<AddRegistNum> iPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personFrom") String personFrom,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("province") String province,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    List<AddRegistNum> selectActivityAddRegistNumExport(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personFrom") String personFrom,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("province") String province,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings,
            @Param("userId") Integer userId
    );

    IPage<VisitNum> selectActivityVisitNum(
            IPage<VisitNum> iPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personFrom") String personFrom,
            @Param("province") String province,
            @Param("realtyConsultant") String realtyConsultant,
            @Param("realtyConsultantPhone") String realtyConsultantPhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("taPersonBuildings")List<TaPersonBuilding> taPersonBuildings
    );

    List<VisitNum> selectActivityVisitNumExport(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personFrom") String personFrom,
            @Param("province") String province,
            @Param("realtyConsultant") String realtyConsultant,
            @Param("realtyConsultantPhone") String realtyConsultantPhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId
    );

    IPage<VisitPersonNum> selectActivityVisitPersonNum(
            IPage<VisitPersonNum> iPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personFrom") String personFrom,
            @Param("province") String province,
            @Param("realtyConsultant") String realtyConsultant,
            @Param("realtyConsultantPhone") String realtyConsultantPhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
    );

    List<VisitPersonNum> selectActivityVisitPersonNumExport(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personFrom") String personFrom,
            @Param("province") String province,
            @Param("realtyConsultant") String realtyConsultant,
            @Param("realtyConsultantPhone") String realtyConsultantPhone,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
    );

    IPage<VisitPersonNum> selectActivityVisitPersonNumByPersonId(
            IPage<VisitPersonNum> iPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personId") String personId,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
    );

    List<VisitPersonNum> selectActivityVisitPersonNumExportByPersonId(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personId") String personId,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("taPersonBuildings") List<TaPersonBuilding> taPersonBuildings
    );

    IPage<VisitNum> selectActivityVisitNumByPersonId(
            IPage<VisitNum> iPage,
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personId") String personId,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId,
            @Param("taPersonBuildings")List<TaPersonBuilding> taPersonBuildings
    );

    List<VisitNum> selectActivityVisitNumExportByPersonId(
            @Param("orgId") Integer orgId,
            @Param("startDate") LocalDateTime startDate,
            @Param("endDate") LocalDateTime endDate,
            @Param("personId") String personId,
            @Param("activityId") String activityId,
            @Param("activityType") String activityType,
            @Param("buildingId") String buildingId
    );

}
