<?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.tofly.gpsboot.mapper.car.CarGpstocarMapper">

    <resultMap id="carGpstocarMap" type="com.tofly.pojo.car.CarGpstocar">
        <id property="id" column="ID"/>
        <result property="carId" column="CAR_ID"/>
        <result property="gpsId" column="GPS_ID"/>
        <result property="updateUser" column="UPDATE_USER"/>
        <result property="updateTime" column="UPDATE_TIME"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="delFlag" column="DEL_FLAG"/>
        <association property="carNumber" column="CAR_ID" select="getcarNumber"></association>
        <association property="meId" column="GPS_ID" select="getmeId"></association>
        <association property="updateUserName" column="UPDATE_USER"
                     select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"></association>
        <association property="createUserName" column="CREATE_USER"
                     select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"></association>
    </resultMap>


    <select id="getcarNumber" resultType="java.lang.Object">
      select CAR_NUMBER as carNumber from tf_car_baseinfo where id = #{carId}
    </select>
    <select id="getmeId" resultType="java.lang.Object">
      select MEID as meId from tf_car_gps where id = #{gpsId}
    </select>

</mapper>
