实体类
public class ShareStore
{
/** 店铺id */
private Long storeId;
/** 轮播图地址*/
private List<String> imageUrls;
}
xml如下
<resultMap type="ShareStore" id="ShareStoreResult">
<result property="storeId" column="store_id" />
<!-- 关联属性对应的表:ShareStore的imageUrls字段 -->
<collection property="imageUrls" ofType="String" select="select_imageUrls" column="store_id"/>
</resultMap>
<!--查询方法表
这个是映射collection 中select_imageUrls的方法
这里的storeId对应collection 中的column="store_id"
-->
<select id="select_imageUrls" resultType="string" parameterType="long">
SELECT
image_url
FROM
share_image
WHERE
business_id = #{storeId}
</select>