知识点:需要用到
<?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="xyz.ctlaowang.day02.mapper.FloorTitleMapper">
<select id="getFloorTitleAll" resultMap="product" >
select
p.name,p.image_src psrc,p.open_type,p.title_id,f.id,f.title,f.image_src fsrc
from
mybatis.floor_title f ,mybatis.product_list p
where p.title_id = f.id and f.id = #{id}
;
</select>
<resultMap id="product" type="FloorTitle">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="imageSrc" column="fsrc"/>
<!--<collection property="productList" 这里的property属性是输出的时候显示的json中的 key值 ofType="ProductList" oftype为pojo中类的名字如com.ruoyi.domain... column="id"> -->
<collection property="productList" ofType="ProductList" column="id">
<result property="name" column="name"/>
<result property="imageSrc" column="psrc"/>
<result property="openType" column="open_type"/>
<result property="titleId" column="title_id"/>
</collection>
</resultMap>
</mapper>