知識點:當傳入參數為數組時,XX.xml文件中,標簽為collection屬性
參考博客:https://blog.csdn.net/javaee_sunny/article/details/52511842
------------------------------------------------------------------------------------------------------------
1.當collection="array"時,傳入參數為數組
例子:
(1) EquipmentMapper 接口
/**
* 根據批量刪除設備信息
*/
int batchdeleteEquipment(String[] eidlist); //如批量刪除數據為15條的話,該返回值int為15
(2) EquipmentMapper.xml
<!--
參數說明
attend_equipment:表名
e_id:表字段名
open:表示語句以什么開始
separator:表示在每次迭代之間,以什么作為分隔符
close:表示以什么結束
collection:表示類型,如果參數是數組,寫成array (若為集合的話,寫成list)
-->
<!--批量刪除設備信息-->
<delete id="batchdeleteEquipment" parameterType="String">
DELETE FROM attend_equipment WHERE e_id IN
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>