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

    <resultMap id="repairplandetailMap" type="com.tofly.pojo.maintain.Repairplandetail">
        <id property="id" column="ID"/>
        <result property="yearId" column="YEAR_ID"/>
        <result property="year" column="YEAR"/>
        <result property="month" column="MONTH"/>
        <result property="typeId" column="TYPE_ID"/>
        <result property="num" column="NUM"/>
        <result property="respUser" column="RESP_USER"/>
        <result property="notes" column="NOTES"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="unit" column="UNIT"/>

    </resultMap>


    <resultMap id="repairplandetailVoMap" type="com.tofly.pojo.maintain.vo.RepairplandetailVo">
        <id property="id" column="ID"/>
        <result property="yearId" column="YEAR_ID"/>
        <result property="year" column="YEAR"/>
        <result property="month" column="MONTH"/>
        <result property="typeId" column="TYPE_ID"/>
        <result property="num" column="NUM"/>
        <result property="respUser" column="RESP_USER"/>
        <result property="notes" column="NOTES"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="unit" column="UNIT"/>
        <association property="typeName" column="TYPE_ID" select="getTypeName"/>
        <association property="respUserName" column="RESP_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
        <association property="createUserName" column="CREATE_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
    </resultMap>

    <select id="getTypeName" resultType="string">
        select  name as typeName from TF_YWPN_REPAIRTYPE_D where id = #{typeId}
    </select>

    <select id="getRepairPlanDetailVoList" resultMap="repairplandetailVoMap">
        select * from TF_YWPN_REPAIRPLANDETAIL_W where YEAR_ID = #{yearId}
    </select>
</mapper>
