mybatis 中where id in ()情况,括号中是list的时候

作者: cheng 发布时间: 2022-10-29 浏览: 527 次 编辑

mybatis 中where id in ()情况,括号中是list的时候

<select id="selectAll" resultMap="BaseResultMap"  >
    select 
    gc_name_1,gc_id_1,gc_id_2
    from order_goods_product
 <where>
     gc_id_1 in 
     <foreach collection="list" item="item" index="index" 
     open="(" separator="," close=")">
      #{item}
        </foreach> and ishistory = 0 
 </where> 
 group by gc_id_1
  </select>

其中collerction是指传入数据的类型