Newer
Older
huludao / src / main / resources / mapper / HouseSiteMapper.xml
<?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.newfiber.api.pc.dao.HouseSiteMapper">

    <resultMap id="houseSiteMap" type="com.newfiber.api.pc.model.meet.HouseSite">
        <id column="h_id" property="hId"/>
        <result column="site_name" property="siteName" />
        <collection property="supList" ofType="com.newfiber.api.pc.model.meet.HouseSiteSupplies">
            <id column="sup_id" property="supId"/>
            <result column="sup_name" property="supName"/>
            <result column="unit" property="unit"/>
            <result column="sup_count" property="supCount"/>
            <result column="h_id" property="hId"/>
            <result column="nature" property="nature"/>
        </collection>

    </resultMap>



    <select id="queryHouseSiteAndSup" resultMap="houseSiteMap">
        select hs.h_id,hs.site_name,hss.sup_id,hss.sup_name,hss.unit,hss.sup_count,hss.h_id,hss.nature FROM
          house_site hs
        LEFT JOIN
          house_site_supplies hss
        on hs.h_id = hss.h_id
    </select>
</mapper>