package com.ningdatech.carapi.driver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.carapi.car.datascreen.model.dto.DataScreenParam;
import com.ningdatech.carapi.common.model.KeyValueDTO;
import com.ningdatech.carapi.common.model.po.MapDataPO;
import com.ningdatech.carapi.driver.entity.DriverInfo;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author LiuXinXin
 * @since 2022-10-09
 */
public interface DriverInfoMapper extends BaseMapper<DriverInfo> {

    /**
     * 驾驶员年龄分布计算
     *
     * @param caseSql      年龄区间计算SQL
     * @param undefinedAge 不参与统计的年龄
     * @param param
     * @return key 年龄、value 驾驶员数量
     * @author WendyYang
     **/
    List<KeyValueDTO<Integer, Long>> driverAgeStatistics(@Param("caseSql") String caseSql,
                                                         @Param("undefinedAge") int undefinedAge,
                                                         @Param("param") DataScreenParam param);

    /**
     * 驾驶员驾龄分布计算
     *
     * @param caseSql      驾龄区间计算SQL
     * @param undefinedAge 不参与统计的驾龄
     * @param param
     * @return key 驾龄、value 驾驶员数量
     * @author WendyYang
     **/
    List<KeyValueDTO<Integer, Long>> drivingExperienceStatistics(@Param("caseSql") String caseSql,
                                                                 @Param("undefinedAge") int undefinedAge,
                                                                 @Param("param") DataScreenParam param);

    List<MapDataPO> diverCountByRegion(@Param("param") DataScreenParam param);

    List<Map<String, Object>> nativePlaceStatisticsByRegion(@Param("param") DataScreenParam param);
}
