<?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.fill.FillSludgeTransferMapper">

    <resultMap id="fillSludgeTransferMap" type="com.tofly.pojo.fill.FillSludgeTransfer">
        <id property="id" column="ID"/>
        <result property="recordTime" column="RECORD_TIME"/>
        <result property="sludgeCar" column="SLUDGE_CAR"/>
        <result property="sludgeTransfer" column="SLUDGE_TRANSFER"/>
        <result property="direction" column="DIRECTION"/>
        <result property="fillDept" column="FILL_DEPT"/>
        <result property="belongStationId" column="BELONG_STATION_ID"/>
        <result property="fillTime" column="FILL_TIME"/>
        <result property="fillUser" column="FILL_USER"/>
        <result property="updateTime" column="UPDATE_TIME"/>
        <result property="updateUser" column="UPDATE_USER"/>
        <association property="sludgeCarName" column="SLUDGE_CAR" select="getSludgeCarName"/>
        <association property="directionName" column="DIRECTION" select="getDirectionName"/>
        <association property="fillDeptName" column="FILL_DEPT" select="com.tofly.gpsboot.mapper.fill.FillEcMapper.getDName"/>
        <association property="belongStationName" column="BELONG_STATION_ID" select="getBelongStationName"/>
        <association property="fillUserName" column="FILL_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
        <association property="updateUserName" column="UPDATE_USER" select="com.tofly.gpsboot.mapper.plan.HydrantrecordMapper.getRealName"/>
    </resultMap>

    <select id="getSludgeCarName" resultType="string">
        select car_Number from TF_CAR_BASEINFO where id = #{sludgeCar}
    </select>

    <select id="getDirectionName" resultType="string">
        select name from tf_ywpn_monitor_stationsiteinfo_w where id = #{direction}
    </select>

    <select id="getSludgeList" resultType="com.tofly.pojo.fill.SludgeVo">
        select name,id from tf_ywpn_monitor_stationsiteinfo_w where category = '1'
    </select>

    <select id="getBelongStationName"  resultType="java.lang.String">
        select name belongStationName
        from tf_ywpn_monitor_stationsiteinfo_w
        where id = #{belongStationId}
    </select>
</mapper>
