MyBatis批量操做

1. List<?>對象

dao接口:java

int batchDelete(List<String> ids);

mapping.xml:數組

<delete id="batchDelete" parameterType="java.util.List">
    delete from test where test_id in
    <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
        #{item}
    </foreach>
</delete>

2. 數組對象

dao接口:app

int batchDelete(String[] ids);

mapping.xml:ide

<delete id="batchDelete" parameterType="java.lang.String">
    delete from test where test_id in
    <foreach collection="array" item="item" index="index" open="(" separator="," close=")">
        #{item}
    </foreach>
</delete>

3. 多參數批量操做

請移步MyBatis多參數批量操做code

4. 屬性說明

MyBatis批量操做

相關文章
相關標籤/搜索