目得:查询评论的同时,将评论的图片查询出来
1.xml如下:
<span style="font-family:Microsoft YaHei;"> <select id="selectCommentGoods" parameterType="com.appdev.db.common.CriteriaParameter" resultType="map">
select
goods.id as goods_id, content, startLevel, service, stream, conform, userid, goodsId, created,
attachment.id as attachment_id, imageName, imageUpdateName, url, commentId, createDate
from comment_goods as goods
left join (select * from(select * from comment_attachment order by createDate)tmp)attachment on goods.id = attachment.commentId
<if test="_parameter != null" >
<include refid="sqlcriteria.util.Example_Where_Clause" />
</if>
order by goods.created
</select></span>