mybatis中的in:

<select id="getByInventoryIds" resultMap="beanMap">
SELECT * FROM <include refid="t_onsale_resource" />
<where>
inventory_id in
<foreach collection="inventoryIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>

dao层:

    List<OnSaleResource> getByInventoryIds(@Param("inventoryIds") List<Long> inventoryIds);
04-14 03:34