controller:
public R mylistBatchRemoveCustomer(@RequestParam("ids[]") Long[] customerIds,Long mylistId{
Map<String, Object> map = new HashMap<String, Object>();
//把数组放入Map集合,后台的数据仍是数组
List<Long> customerId = Arrays.asList(customerIds);
map.put("customerId", customerId);
map.put("mylistId", mylistId);
mylistService.mylistBatchRemoveCustomer(map);
return R.ok();
}
Mapper:
<delete id="mylistBatchRemoveCustomer" parameterType="map">
delete from wdkh_mylist_relation where mylist_id = #{mylistId} and customer_id in
<foreach item="item" collection="customerId" open="(" separator="," close=")">
#{item}
</foreach>
</delete>