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

    <resultMap id="scadastationMap" type="com.tofly.xrtygis.entity.Scadastation">
        <id property="id" column="ID"/>
        <result property="stcd" column="STCD"/>
        <result property="stnm" column="STNM"/>
        <result property="lgtd" column="LGTD"/>
        <result property="lttd" column="LTTD"/>
        <result property="state" column="STATE"/>
        <result property="iscraft" column="ISCRAFT"/>
        <result property="respuserId" column="RESPUSER_ID"/>
        <result property="notes" column="NOTES"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="rangeid" column="RANGEID"/>
        <result property="categoryName" column="CATEGORY_NAME"/>
        <result property="sn" column="SN"/>
        <result property="pipeSid" column="PIPE_SID"/>
        <association property="respuserName" column="RESPUSER_ID"
                     select="getUserName"/>
        <association property="createUserName" column="CREATE_USER"
                     select="com.tofly.xrtygis.mapper.IFileMapper.getUserName"/>
    </resultMap>

    <select id="stationName" resultType="string">
        select STNM
        from TF_YWPN_SCADASTATION_B
        where ID = #{id}
    </select>

    <select id="getUserName" resultType="string">
        select real_name from tf_smpn_user_x where id in (${ids})
    </select>


</mapper>
