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

    <resultMap id="deptCarMap" type="com.tofly.pojo.car.DeptCar">
        <id property="id" column="ID"/>
        <result property="filePath" column="FILE_PATH"/>
        <result property="fileName" column="FILE_NAME"/>
        <result property="fileType" column="FILE_TYPE"/>
        <result property="name" column="NAME"/>
        <result property="creatUser" column="CREAT_USER"/>
        <result property="creatTime" column="CREAT_TIME"/>
        <result property="updateTime" column="UPDATE_TIME"/>
        <result property="parentId" column="PARENT_ID"/>
        <result property="delFlag" column="DEL_FLAG"/>
        <result property="state" column="STATE"/>
        <result property="sort" column="SORT"/>
        <association property="stateName" column="STATE" select="getStateName"/>
        <association property="creatUserName" column="CREAT_USER"
                     select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
    </resultMap>

    <select id="getStateName" resultType="java.lang.Object">
      select select (case #{state} when '0' then '目录' when '1' then '文件' end) as stateName
    </select>
</mapper>
