<?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.emergency.EmergencyDisMapper">

    <resultMap id="emergencyDisMap" type="com.tofly.pojo.emergency.EmergencyDis">
        <id property="id" column="ID"/>
        <result property="emergencyId" column="EMERGENCY_ID"/>
        <result property="state" column="STATE"/>
        <result property="note" column="NOTE"/>
        <result property="fileIdsOne" column="FILE_IDS_ONE"/>
        <result property="fileIdsTow" column="FILE_IDS_TOW"/>
        <result property="fileIdsThree" column="FILE_IDS_THREE"/>
        <result property="isHis" column="IS_HIS"/>
        <result property="disUserId" column="DIS_USER_ID"/>
        <result property="disTime" column="DIS_TIME"/>
        <result property="flag" column="FLAG"/>
        <result property="auditResult" column="AUDIT_RESULT"/>
        <result property="auditNote" column="AUDIT_NOTE"/>
        <result property="auditUser" column="AUDIT_USER"/>
        <result property="auditTime" column="AUDIT_TIME"/>
        <association property="stateName" column="STATE" select="getStateName"/>
        <association property="filePathOneList" column="FILE_IDS_ONE" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getFilePathList"/>
        <association property="filePathTowList" column="FILE_IDS_TOW" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getFilePathList"/>
        <association property="filePathThreeList" column="FILE_IDS_THREE" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getFilePathList"/>
        <association property="disUserName" column="DIS_USER_ID" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
        <association property="auditResultName" column="AUDIT_RESULT" select="com.tofly.gpsboot.mapper.comm.AuditMapper.getAuditStateName"/>
        <association property="auditUserName" column="AUDIT_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
    </resultMap>
    <select id="getStateName" resultType="string">
        SELECT CNAME
        FROM
            TF_YWPN_SYSCHILDCODE_D
        WHERE
            PCID =52200
          AND
            CCODE = #{state}
    </select>

    <select id="getEmergencyDisList" resultMap="emergencyDisMap">
        select * from TF_YWPN_EMERGENCY_DIS_W
        where EMERGENCY_ID = #{id}
    </select>

</mapper>
