在xml 直接遍历
and h.hotel_id in
<foreach collection="hotelNoList" item="hotelNoList" open="(" separator="," close=")">
#{hotelNoList}
</foreach>
本文介绍了一种在XML文件中使用MyBatis框架的foreach标签遍历酒店ID列表的方法。通过设置collection属性为hotelNoList,并指定item、open、separator和close属性,可以有效地在SQL语句中实现IN子句的动态生成。
在xml 直接遍历
and h.hotel_id in
<foreach collection="hotelNoList" item="hotelNoList" open="(" separator="," close=")">
#{hotelNoList}
</foreach>

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