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

    <resultMap id="bwcjblMap" type="com.tofly.watermeter.entity.Bwcjbl">
        <id property="id" column="ID"/>
        <result property="bwLsbh" column="BW_LSBH"/>
        <result property="bwSbkj" column="BW_SBKJ"/>
        <result property="bwHgsl" column="BW_HGSL"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="createDate" column="CREATE_DATE"/>
        <result property="bwBz" column="BW_BZ"/>
        <result property="belong" column="BELONG"/>
        <association property="createUserName" column="CREATE_USER"
                     select="com.tofly.baseapi.mapper.ToflyCodeCommonMapper.getUserName"/>
        <association property="sbkjName" column="BW_SBKJ"
                     select="getSbkjName"/>
    </resultMap>
    <select id="getConfig" resultMap="bwcjblMap">
        select ID,BW_SBKJ,BW_HGSL,CREATE_USER,CREATE_DATE,BW_BZ from TF_YWPN_BWCJBL_W
    </select>

    <select id="getSbkjName" resultType="string">
        select CNAME from TF_YWPN_SYSCHILDCODE_D where PCID = 1 and CCODE = to_char(${id})
    </select>


</mapper>
