<?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.plan.PlanMtMapper">

    <resultMap id="planMtMap" type="com.tofly.pojo.plan.PlanMt">
        <id property="id" column="ID"/>
        <result property="maintainTime" column="MAINTAIN_TIME"/>
        <result property="maintainType" column="MAINTAIN_TYPE"/>
        <result property="maintainNote" column="MAINTAIN_NOTE"/>
        <result property="maintainAddress" column="MAINTAIN_ADDRESS"/>
        <result property="maintainUserId" column="MAINTAIN_USER_ID"/>
        <result property="planChildId" column="PLAN_CHILD_ID"/>
        <result property="planId" column="PLAN_ID"/>
        <result property="maintainCode" column="MAINTAIN_CODE"/>
        <result property="fileIdsOne" column="FILE_IDS_ONE"/>
        <result property="fileIdsTow" column="FILE_IDS_TOW"/>
        <result property="fileIdsThree" column="FILE_IDS_THREE"/>
        <result property="x" column="X"/>
        <result property="y" column="Y"/>
        <result property="flag" column="FLAG"/>
        <result property="isHis" column="IS_HIS"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <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="maintainTypeName" column="MAINTAIN_TYPE" select="getMaintainTypeName"/>
        <association property="maintainUserIdName" column="MAINTAIN_USER_ID" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
        <association property="createUserName" column="CREATE_USER"
                     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"/>
        <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"/>
        <collection property="contentList" column="ID" select="com.tofly.gpsboot.mapper.plan.PlanMtRelMapper.getContentList"/>
    </resultMap>


    <select id="getMaintainTypeName" resultType="string">
        SELECT CNAME
        FROM
            TF_YWPN_SYSCHILDCODE_D
        WHERE
            PCID =51700
          AND
            CCODE = #{maintainType}
    </select>

</mapper>
