<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.carapi.driver.mapper.BehaviourAnalysisMapper">

<select id="selectDriverAbnormalBehaviorAnalysisByCarPlate"
            resultType="com.ningdatech.carapi.driver.entity.DriverAbnormalBehaviorAnalysis">
    select ndaaw.bg_type as alarmType,ndaaw.warn_time as alarmTime,
           ndaaw.vehicle_no as carPlate,ndaaw.grade as alarmLevel,
           ndaaw.speed,ndaaw.content as addressInfo,
           ndaaw.id as supplierDataId,
           ndaaw.gnss_center_id as gnssCenterId,
           ndaaw.alarm_msg_sn as alarmMsgSn,
           ndaaw.address as alarmAddress
    from nd_data_access_alarm_warn as ndaaw
    where ndaaw.id > #{index}
    order by ndaaw.id
</select>

<select id="selectDriverAbnormalBehaviorAnalysisAppendixData"
            resultType="com.ningdatech.carapi.driver.model.po.AlarmWarnFilePO">
    select alarm_msg_sn,file_type,file_path
    from nd_data_access_alarm_warn_file
    where alarm_msg_sn in
    <foreach collection="alarmMsgSnList" open="(" close=")" separator="," item="alarmMsgSn">
        #{alarmMsgSn}
    </foreach>
</select>

<select id="selectOneByAlarmMsgSn" resultType="java.lang.Long">
    select id from nd_driver_abnormal_behavior_analysis where alarm_msg_sn = #{alarmMsgSn}
</select>
</mapper>