<?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.watermeter.mapper.QfkgjlMapper">

    <resultMap id="qfkgjlMap" type="com.tofly.watermeter.entity.Qfkgjl">
        <id property="id" column="ID"/>
        <result property="yhbh" column="YHBH"/>
        <result property="yhxm" column="YHXM"/>
        <result property="yhdz" column="YHDZ"/>
        <result property="lxdh" column="LXDH"/>
        <result property="sbcj" column="SBCJ"/>
        <result property="sblx" column="SBLX"/>
        <result property="sbkj" column="SBKJ"/>
        <result property="ysxz" column="YSXZ"/>
        <result property="fmzt" column="FMZT"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createDept" column="CREATE_DEPT"/>
        <result property="kgTime" column="KG_TIME"/>
        <result property="bz" column="BZ"/>
        <result property="tsbh" column="TSBH"/>
        <result property="address" column="ADDRESS"/>
        <association property="fmztName" column="FMZT" select="getFmztName"/>
        <association property="createDeptName" column="CREATE_DEPT"
                     select="getCreateDeptName"/>
        <association property="createUserName" column="CREATE_USER"
                     select="com.tofly.baseapi.mapper.ToflyCodeCommonMapper.getUserName"/>
        <association property="sbcjName" column="SBCJ"
                     select="com.tofly.watermeter.mapper.BwrksbdatailMapper.getVendor"/>
        <association property="sbkjName" column="SBKJ"
                     select="com.tofly.watermeter.mapper.BwrksbdatailMapper.getCal"/>
        <association property="sblxName" column="SBLX"
                     select="com.tofly.watermeter.mapper.BwrksbdatailMapper.getType"/>
        <association property="ysxzName" column="YSXZ"
                     select="com.tofly.watermeter.mapper.QfkhjbxxMapper.getYsxzName"/>
    </resultMap>
    <select id="getFmztName" resultType="java.lang.String">
        select decode(#{fmzt}, '0', '关闭', '1', '开启')
        from dual
    </select>

    <select id="getCreateDeptName" resultType="string">
        select NAME
        from TF_SMPN_DEPARTMENT_X
        where ID = #{id}
    </select>


</mapper>
