package com.xhpc.card.mapper;

import com.xhpc.card.pojo.XhpcHistoryOrder;
import org.apache.ibatis.annotations.Param;

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

public interface XhpcHistoryOrderMapper {

    int deleteByPrimaryKey(Long historyOrderId);

    int insert(XhpcHistoryOrder record);

    int insertSelective(XhpcHistoryOrder record);

    XhpcHistoryOrder selectByPrimaryKey(Long historyOrderId);

    int updateByPrimaryKeySelective(XhpcHistoryOrder record);

    int updateByPrimaryKey(XhpcHistoryOrder record);

    /**
     * query user total count by multiple tenant id and multiple charging station id and user type
     *
     * @author WH
     * @date 2022/3/4 15:32
     * @since version-1.0
     */
    Long selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(
            @Param("tenantIdsStr") String tenantIdsStr,
            @Param("chargingStationIdList") List<Long> chargingStationIdList,
            @Param("userType") Integer userType,
            @Param("currentTime") String currentTime);

    //社区和B端用户统计
    Long countUserType(@Param("tenantIdsStr") String tenantIdsStr,
                       @Param("chargingStationIdList") List<Long> chargingStationIdList,
                       @Param("userType") Integer userType,
                       @Param("currentTime") String currentTime);


    //社区用户统计
    Long xhpcCommunityPersonnelSum();

    //B端用户统计
    Long xhpcCustomersPersonnelSum();

    /**
     * query total electric quantity by multiple tenant or multiple charging station
     *
     * @author WH
     * @date 2022/3/9 16:29
     * @since version-1.0
     */
    Long selectTotalElectricQuantity(
            @Param("tenantIdsStr") String tenantIdsStr,
            @Param("chargingStationIdList") List<Long> chargingStationIdList);

    Long selectCountByTenantIdsAndChargingStationIds(
            @Param("tenantIdsStr") String tenantIdsStr,
            @Param("chargingStationIdList") List<Long> chargingStationIdList);

    Long selectOrderCountBy(
            @Param("tenantIdsStr") String tenantIdsStr,
            @Param("chargingStationIdList") List<Long> chargingStationIdList,
            @Param("userType") Integer userType,
            @Param("operatorId3rdptyEvcs") String operatorId3rdptyEvcs);

    /**
     * query order trend of recent 15 day
     *
     * @author WH
     * @date 2022/3/18 10:31
     * @since version-1.0
     */
    List<Map<String, Object>> selectOrderTrendByTenantIdsAndChargingStationIds(
            @Param("tenantIdsStr") String tenantIdsStr,
            @Param("chargingStationIdList") List<Long> chargingStationIdList);

}