jane27 发表于 2016-11-25 09:56:21

mybatis foreach标签

<select id="selectTestForEach" parameterType="News" resultMap="NewsResultMapper">
select * from t_news n where
<foreach collection="listTag" index="index" item="tag" open="("
    separator="," close=")">
   #{tag} in n.tags
</foreach>

foreach 生成的效果是集合 转化为下面的
select * from t_news n where ( ? in n.tags , ? in n.tags )
页: [1]
查看完整版本: mybatis foreach标签