<?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.FlightDataMapper">

    <resultMap id="BaseResultMap" type="com.tuoheng.admin.entity.FlightData">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
        <result column="inspection_id" jdbcType="VARCHAR" property="inspectionId" />
        <result column="box_sn" jdbcType="VARCHAR" property="boxSn" />
        <result column="lng" jdbcType="VARCHAR" property="lng" />
        <result column="lat" jdbcType="VARCHAR" property="lat" />
        <result column="altitude" jdbcType="VARCHAR" property="altitude" />
        <result column="ultrasonic" jdbcType="VARCHAR" property="ultrasonic" />
        <result column="pitch" jdbcType="VARCHAR" property="pitch" />
        <result column="roll" jdbcType="VARCHAR" property="roll" />
        <result column="yaw" jdbcType="VARCHAR" property="yaw" />
        <result column="airspeed" jdbcType="VARCHAR" property="airspeed" />
        <result column="velocity" jdbcType="VARCHAR" property="velocity" />
        <result column="timestamp" jdbcType="VARCHAR" property="timestamp" />
        <result column="is_srt" jdbcType="INTEGER" property="isSrt" />
        <result column="create_user" jdbcType="VARCHAR" property="createUser" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="update_user" jdbcType="VARCHAR" property="updateUser" />
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
        <result column="mark" jdbcType="INTEGER" property="mark" />
    </resultMap>

    <sql id="Base_Column_List">
    id, tenant_id, inspection_id, box_sn, lng, lat, altitude, ultrasonic, pitch, roll, yaw, airspeed,
    velocity, `timestamp`, is_srt, create_user, create_time, update_user, update_time, mark
    </sql>

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

</mapper>