<?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.maintain.PipeMfRecordMapper">

    <resultMap id="pipeMfRecordMap" type="com.tofly.pojo.maintain.PipeMfRecord">
        <id property="id" column="ID"/>
        <result property="maintainDept" column="MAINTAIN_DEPT"/>
        <result property="maintainTime" column="MAINTAIN_TIME"/>
        <result property="valveLocation" column="VALVE_LOCATION"/>
        <result property="facilitiesType" column="FACILITIES_TYPE"/>
        <result property="facilitiesCaliber" column="FACILITIES_CALIBER"/>
        <result property="code" column="CODE"/>
        <result property="orderCode" column="ORDER_CODE"/>
        <result property="orderId" column="ORDER_ID"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="fileIdsOne" column="FILE_IDS_ONE"/>
        <result property="fileIdsTow" column="FILE_IDS_TOW"/>
        <result property="fileIdsThree" column="FILE_IDS_THREE"/>
        <result property="flag" column="FLAG"/>
        <result property="repairUserId" column="REPAIR_USER_ID"/>
        <result property="x" column="X"/>
        <result property="y" column="Y"/>
        <result property="regionCode" column="REGION_CODE"/>
        <result property="regionName" column="REGION_NAME"/>
        <association property="createTimeSrt" column="CREATE_TIME" select="com.tofly.gpsboot.mapper.maintain.RepairrejectMapper.getTimeStr"/>
        <association property="maintainTimeSrt" column="MAINTAIN_TIME" select="com.tofly.gpsboot.mapper.maintain.RepairrejectMapper.getTimeStr"/>
        <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="createUserName" column="CREATE_USER"
                     select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
        <association property="pipeMfContentList" column="ID" select="getPipeMfContentList"/>
        <association property="pipeMfEvaluateList" column="ID" select="getPipeMfEvaluateList"/>

    </resultMap>


    <select id="getPipeMfContentList" resultType="com.tofly.pojo.maintain.PipeMfContent">
        select b.*
        FROM TF_YMPN_PIPE_MF_RECORD_W a
                 LEFT JOIN TF_YMPN_PIPE_MF_CONTENT_W b
                           on a.ID = b.MF_ID
        where a.id = #{ID}
        ORDER BY b.MF_SERIAL_NUMBER
    </select>

    <select id="getPipeMfEvaluateList" resultType="com.tofly.pojo.maintain.PipeMfEvaluate">
        select c.*
        FROM TF_YMPN_PIPE_MF_RECORD_W a
                 LEFT JOIN TF_YMPN_PIPE_MF_EVALUATE_W c
                           on a.id = c.mf_id
        where a.id = #{ID}
        ORDER BY c.MF_EVALUATE_SERIAL_NUMBER
    </select>
</mapper>
