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 )

猜你喜欢

转载自417755712.iteye.com/blog/2261034