<if test="mcomIdList != null and mcomIdList.size() > 0">
AND tp.MCOM_ID IN
<foreach item="item" index="index" collection="mcomIdList" open="(" separator="," close=")">
#{mcomIdList[${index}],jdbcType=BIGINT}
</foreach>
</if>
或
<if test="mcomIdList != null and mcomIdList.size() > 0">
AND tp.MCOM_ID IN
<foreach collection="mcomIdList" open="(" close=")" separator="," index="index" item="item">
#{item}
</foreach>
</if>
本文探讨了在MyBatis中使用foreach标签进行批量条件查询的实现方式,通过具体的XML代码示例,展示了如何利用mcomIdList集合进行IN条件的SQL拼接,实现了高效的数据检索。
803

被折叠的 条评论
为什么被折叠?



