<resultMap id="myNewItemsVo" type="com.imooc.pojo.vo.NewItemsVo">
<id column="rootCatId" property="rootCatId"/>
<result column="rootCatName" property="rootCatName"/>
<result column="slogan" property="slogan"/>
<result column="catImage" property="catImage"/>
<result column="bgColor" property="bgColor"/>
<collection property="simpleItemList" ofType="com.imooc.pojo.vo.SimpleItemVo">
<id column="itemId" property="itemId"/>
<result column="itemName" property="itemName"/>
<result column="itemUrl" property="itemUrl"/>
</collection>
</resultMap>
<select id="getSixNewItemsLazy" resultMap="myNewItemsVo" parameterType="Map">
SELECT
f.id AS id,
f.`name` AS NAME,
f.slogan AS slogan,
f.cat_image AS catImage,
f.bg_color AS bgColor,
i.id AS itemId,
i.item_name AS itemName,
ii.url AS itemUrl,
i.created_time AS createTime
FROM
`category` f
LEFT JOIN items i ON i.root_cat_id = f.id
LEFT JOIN items_img ii ON ii.item_id = i.id
WHERE
f.type = 1
AND
i.root_cat_id = #{paramsMap.rootCatId}
AND
ii.is_main = 1
ORDER BY
i.created_time
DESC
LIMIT 0,6
</select>
三、CategoryMapperCustom
public List<NewItemsVo> getSixNewItemsLazy(@Param("paramsMap") Map<String, Object> map);