<sqlMap namespace="search">
<resultMap id="video-map" class="xx.index.dataset.VideoVO" groupBy="videoId">
<result property="videoId" column="videoId" />
............................
<result property="tagList" resultMap="search.tag-map" />
</resultMap>
<resultMap id="tag-map" class="java.util.HashMap">
<result property="tagName" column="tagName" />
</resultMap>
<statement id="query" resultMap="video-map" parameterClass="xx.index.dataset.DataSetVO" >
select v.videoId as videoId,
.............
vtg.name as tagname,
............
from video v
inner join videotagrel vtgrel on v.videoId=vtgrel.videoId
inner join videotag vtg on vtgrel.tagId=vtg.tagId
...........
</statement>
........
</sqlMap>
解决Ibatis一对多映射n+1问题
最新推荐文章于 2018-05-09 09:34:49 发布