mybaits in

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);
原文地址:https://www.cnblogs.com/gmq-sh/p/5216871.html