160315、mybatis批量删除

<deleteid="deleteCTQ" parameterType="java.lang.String">

DELETE FROM sqm_product_ctq_current where guid in

<foreach item="idItem"collection="array"open="("separator=","close=")">

#{idItem}

</foreach>

</delete>

sqm_product_ctq_current 表名

guid  字段名

collection里表示类型,这里是array,还可以是list

idItem不用管,相当于一个变量

 

这个是写在xxxMapper.xml里的

id="deleteCTQ"在xxxMapper.java里需要有对应的方法

 

void deleteCTQ(String[] ctqGuids);

这里传进来的参数就是一个字符串型的数据

原文地址:https://www.cnblogs.com/zrbfree/p/5281251.html