首页 > 技术文章 > mybaits in

gmq-sh 2016-02-25 14:22 原文

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);

 

推荐阅读