<?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.xrtygis.mapper.TfLossCensusMapper">

  <resultMap id="tfLossCensusMap" type="com.tofly.xrtygis.entity.TfLossCensus">
                <id property="id" column="ID"/>
                      <result property="type" column="TYPE"/>
                      <result property="name" column="NAME"/>
                      <result property="fillingType" column="FILLING_TYPE"/>
                      <result property="fillingDate" column="FILLING_DATE"/>
                      <result property="unit" column="UNIT"/>
                      <result property="expendAmount" column="EXPEND_AMOUNT"/>
                      <result property="createUser" column="CREATE_USER"/>
                      <result property="createTime" column="CREATE_TIME"/>
                      <association property="typeName" column="TYPE" select="getTypeName"/>
                      <association property="fillingTypeName" column="FILLING_TYPE" select="getFillingTypeName"/>
                      <association property="createUserName"  column="CREATE_USER" select="com.tofly.xrtygis.mapper.IFileMapper.getUserName" ></association>
  </resultMap>

    <select id="getTypeName" resultType="string">
        SELECT CNAME
        FROM
            TF_YWPN_SYSCHILDCODE_D
        WHERE
            PCID =60020
          AND
            CCODE = #{type}
    </select>

    <select id="getFillingTypeName" resultType="string">
        SELECT NAME
        FROM
            TF_WATER_INFO
        WHERE
            ID = #{fillingType}
    </select>


                                                        
</mapper>
