<?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.tuoheng.admin.mapper.FlightDataHlMapper">

    <resultMap id="BaseResultMap" type="com.tuoheng.admin.entity.FlightDataHl">
        <result property="id"    column="id"    />
        <result property="tenantId"    column="tenant_id"    />
        <result property="inspectionId"    column="inspection_id"    />
        <result property="recordId"    column="record_id"    />
        <result property="attachRD"    column="attach_r_d"    />
        <result property="uavId"    column="uav_id"    />
        <result property="uavNo"    column="uav_no"    />
        <result property="time"    column="time"    />
        <result property="alt"    column="alt"    />
        <result property="lng"    column="lng"    />
        <result property="lat"    column="lat"    />
        <result property="spd"    column="spd"    />
        <result property="ht"    column="ht"    />
        <result property="head"    column="head"    />
        <result property="pit"    column="pit"    />
        <result property="roll"    column="roll"    />
        <result property="bat"    column="bat"    />
        <result property="vol"    column="vol"    />
        <result property="fuel"    column="fuel"    />
        <result property="act"    column="act"    />
        <result property="mode"    column="mode"    />
        <result property="flightMode"    column="flight_mode"    />
        <result property="arm"    column="arm"    />
        <result property="air"    column="air"    />
        <result property="absp"    column="absp"    />
        <result property="temp"    column="temp"    />
        <result property="tc"    column="tc"    />
        <result property="velocityZ"    column="velocity_z"    />
        <result property="remainingFlightTime"    column="remaining_flight_time"    />
        <result property="moduleSignal"    column="module_signal"    />
        <result property="satellite"    column="satellite"    />
        <result property="deptId"    column="dept_id"    />
        <result property="appConnected"    column="app_connected"    />
        <result property="groundConnected"    column="ground_connected"    />
        <result property="controlDevice"    column="control_device"    />
        <result property="rcControlPosition"    column="rc_control_position"    />
        <result property="gps"    column="gps"    />
        <result property="ultrasonicHeight"    column="ultrasonic_height"    />
        <result property="altitudeFused"    column="altitude_fused"    />
        <result property="latLonAltitude"    column="lat_lon_altitude"    />
        <result property="homeLocation"    column="home_location"    />
        <result property="duration"    column="duration"    />
        <result property="battery1CapacityPercent"    column="battery1_capacity_percent"    />
        <result property="battery1Voltage"    column="battery1_voltage"    />
        <result property="battery1Temperature"    column="battery1_temperature"    />
        <result property="battery1HeatState"    column="battery1_heat_state"    />
        <result property="battery2CapacityPercent"    column="battery2_capacity_percent"    />
        <result property="battery2Voltage"    column="battery2_voltage"    />
        <result property="battery2Temperature"    column="battery2_temperature"    />
        <result property="battery2HeatState"    column="battery2_heat_state"    />
        <result property="gimbalPitch"    column="gimbal_pitch"    />
        <result property="gimbalYaw"    column="gimbal_yaw"    />
        <result property="gimbalRoll"    column="gimbal_roll"    />
        <result property="zoomRatio"    column="zoom_ratio"    />
        <result property="focalLength"    column="focal_length"    />
        <result property="videoStreamSource"    column="video_stream_source"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="mark"    column="mark"    />
    </resultMap>

    <sql id="Base_Column_List">
        id, tenant_id, inspection_id, record_id, attach_r_d, uav_id, uav_no, time, alt, lng, lat, spd, ht,
head, pit, roll, bat, vol, fuel, act, mode, flight_mode, arm, air, absp, temp, tc, velocity_z, remaining_flight_time,
module_signal, satellite, deptId, app_connected, ground_connected, control_device, rc_control_position, gps, ultrasonic_height,
altitude_fused, lat_lon_altitude, home_location, duration, battery1_capacity_percent, battery1_voltage, battery1_temperature,
battery1_heat_state, battery2_capacity_percent, battery2_voltage, battery2_temperature, battery2_heat_state, gimbal_pitch, gimbal_yaw,
gimbal_roll, zoom_ratio, focal_length, video_stream_source, create_user, create_time, update_user, update_time, mark
    </sql>

    <sql id="selectThFlightDataHlVo">
        select id, tenant_id, inspection_id, recordId, attachRD, uavId, uavNo, time, alt, lng, lat, spd, ht, head, pit, roll, bat, vol, fuel, act, mode, flightMode, arm, air, absp, temp, tc, velocityZ, remainingFlightTime, moduleSignal, satellite, deptId, appConnected, groundConnected, controlDevice, rcControlPosition, gps, ultrasonicHeight, altitudeFused, latLonAltitude, homeLocation, duration, battery1CapacityPercent, battery1Voltage, battery1Temperature, battery1HeatState, battery2CapacityPercent, battery2Voltage, battery2Temperature, battery2HeatState, gimbalPitch, gimbalYaw, gimbalRoll, zoomRatio, focalLength, videoStreamSource, create_user, create_time, update_user, update_time, mark from th_flight_data_hl
    </sql>

    <select id="selectListByInspectionId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from th_flight_data_hl
        where inspection_id = #{id}
        and mark = 1
        order by create_time asc
    </select>


    <!-- 批量新增问题图片 -->
    <insert id="addBatch" parameterType="com.tuoheng.admin.entity.FlightDataHl">
        insert into th_flight_data_hl (id, tenant_id, inspection_id, record_id, attach_r_d, uav_id, uav_no, time, alt, lng, lat, spd, ht,
        head, pit, roll, bat, vol, fuel, act, mode, flight_mode, arm, air, absp, temp, tc, velocity_z, remaining_flight_time,
        module_signal, satellite, deptId, app_connected, ground_connected, control_device, rc_control_position, gps, ultrasonic_height,
        altitude_fused, lat_lon_altitude, home_location, duration, battery1_capacity_percent, battery1_voltage, battery1_temperature,
        battery1_heat_state, battery2_capacity_percent, battery2_voltage, battery2_temperature, battery2_heat_state, gimbal_pitch, gimbal_yaw,
        gimbal_roll, zoom_ratio, focal_length, video_stream_source, create_user, create_time)
        values
        <foreach collection="list" item="item" separator=",">
            (
            #{item.id,jdbcType=BIGINT},
            #{item.tenantId,jdbcType=VARCHAR},
            #{item.inspectionId,jdbcType=INTEGER},
            #{item.recordId,jdbcType=BIGINT},
            #{item.attachRD,jdbcType=BIGINT},
            #{item.uavId,jdbcType=BIGINT},
            #{item.uavNo,jdbcType=BIGINT},
            #{item.time,jdbcType=BIGINT},
            #{item.alt,jdbcType=VARCHAR},
            #{item.lng,jdbcType=VARCHAR},
            #{item.lat,jdbcType=VARCHAR},
            #{item.spd,jdbcType=VARCHAR},
            #{item.ht,jdbcType=VARCHAR},
            #{item.head,jdbcType=VARCHAR},
            #{item.pit,jdbcType=VARCHAR},
            #{item.roll,jdbcType=VARCHAR},
            #{item.bat,jdbcType=VARCHAR},
            #{item.vol,jdbcType=VARCHAR},
            #{item.fuel,jdbcType=VARCHAR},
            #{item.act,jdbcType=BIGINT},
            #{item.mode,jdbcType=BIGINT},
            #{item.flightMode,jdbcType=VARCHAR},
            #{item.arm,jdbcType=VARCHAR},
            #{item.air,jdbcType=VARCHAR},
            #{item.absp,jdbcType=VARCHAR},
            #{item.temp,jdbcType=VARCHAR},
            #{item.tc,jdbcType=VARCHAR},
            #{item.velocityZ,jdbcType=VARCHAR},
            #{item.remainingFlightTime,jdbcType=VARCHAR},
            #{item.moduleSignal,jdbcType=VARCHAR},
            #{item.satellite,jdbcType=VARCHAR},
            #{item.deptId,jdbcType=BIGINT},
            #{item.appConnected,jdbcType=VARCHAR},
            #{item.groundConnected,jdbcType=VARCHAR},
            #{item.controlDevice,jdbcType=VARCHAR},
            #{item.rcControlPosition,jdbcType=VARCHAR},
            #{item.gps,jdbcType=VARCHAR},
            #{item.ultrasonicHeight,jdbcType=VARCHAR},
            #{item.altitudeFused,jdbcType=VARCHAR},
            #{item.latLonAltitude,jdbcType=VARCHAR},
            #{item.homeLocation,jdbcType=VARCHAR},
            #{item.duration,jdbcType=VARCHAR},
            #{item.battery1CapacityPercent,jdbcType=VARCHAR},
            #{item.battery1Voltage,jdbcType=VARCHAR},
            #{item.battery1Temperature,jdbcType=VARCHAR},
            #{item.battery1HeatState,jdbcType=VARCHAR},
            #{item.battery2CapacityPercent,jdbcType=VARCHAR},
            #{item.battery2Voltage,jdbcType=VARCHAR},
            #{item.battery2Temperature,jdbcType=VARCHAR},
            #{item.battery2HeatState,jdbcType=VARCHAR},
            #{item.gimbalPitch,jdbcType=VARCHAR},
            #{item.gimbalYaw,jdbcType=VARCHAR},
            #{item.gimbalRoll,jdbcType=VARCHAR},
            #{item.zoomRatio,jdbcType=VARCHAR},
            #{item.focalLength,jdbcType=VARCHAR},
            #{item.videoStreamSource,jdbcType=VARCHAR},
            #{item.createUser,jdbcType=VARCHAR},
            #{item.createTime,jdbcType=TIMESTAMP}
            )
        </foreach>
    </insert>

</mapper>