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

  <resultMap id="tfCarInsuranceMap" type="com.tofly.pojo.car.TfCarInsurance">
                <id property="id" column="ID"/>
                      <result property="carNumber" column="CAR_NUMBER"/>
                      <result property="outDangerTime" column="OUT_DANGER_TIME"/>
                      <result property="outDangerContent" column="OUT_DANGER_CONTENT"/>
                      <result property="involveUser" column="INVOLVE_USER"/>
                      <result property="accidentLevel" column="ACCIDENT_LEVEL"/>
                      <result property="accidentDuty" column="ACCIDENT_DUTY"/>
                      <result property="applyDept" column="APPLY_DEPT"/>
                      <result property="applyUser" column="APPLY_USER"/>
                      <result property="applyTime" column="APPLY_TIME"/>
                      <result property="oneAuditDept" column="ONE_AUDIT_DEPT"/>
                      <result property="oneAuditUser" column="ONE_AUDIT_USER"/>
                      <result property="oneAuditTime" column="ONE_AUDIT_TIME"/>
                      <result property="oneAuditContent" column="ONE_AUDIT_CONTENT"/>
                      <result property="twoAuditDept" column="TWO_AUDIT_DEPT"/>
                      <result property="twoAuditUser" column="TWO_AUDIT_USER"/>
                      <result property="twoAuditTime" column="TWO_AUDIT_TIME"/>
                      <result property="twoAuditContent" column="TWO_AUDIT_CONTENT"/>
                      <result property="auditStatus" column="AUDIT_STATUS"/>
                      <result property="annex" column="ANNEX"/>
                      <result property="remark" column="REMARK"/>
                      <result property="createTime" column="CREATE_TIME"/>
                      <result property="createUser" column="CREATE_USER"/>
                    <association property="createUserName" column="CREATE_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
                    <association property="applyDeptName" column="APPLY_DEPT" select="getDeptName"/>
                    <association property="applyUserName" column="APPLY_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
                    <association property="oneAuditDeptName" column="ONE_AUDIT_DEPT" select="getDeptName"/>
                    <association property="oneAuditUserName" column="ONE_AUDIT_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
                    <association property="twoAuditDeptName" column="TWO_AUDIT_DEPT" select="getDeptName"/>
                    <association property="twoAuditUserName" column="TWO_AUDIT_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
  </resultMap>

      <select id="getDeptName" resultType="string">
            SELECT NAME
            FROM TF_SMPN_DEPARTMENT_X
            WHERE ID = #{deptId}
      </select>


                                                                                                                                            
</mapper>
