mysql批量导入删除
批量导入
<insert id="extractOrderBaseHis">
INSERT INTO `odr_order_base_his`
(`order_base_id`,`consumer_id`, `quantity`, `money`, `delivery_money`, `request_ip`, `create_time`, `modify_time`, `virtual_money`, `activity_code`, `import_time`)
SELECT `order_base_id`,`consumer_id`, `quantity`, `money`, `delivery_money`, `request_ip`, `create_time`, `modify_time`, `virtual_money`, `activity_code`, now()
FROM odr_order_base t1
WHERE EXISTS (SELECT order_base_id FROM odr_order_commodity
WHERE order_base_id = t1.order_base_id and status IN
<foreach collection="statusList" item="status" separator="," open="(" close=")">
#{status}
</foreach>
AND create_time<![CDATA[ < ]]>#{param.todayStart})
</insert>
批量删除
<delete id="deleteOrderBase">
DELETE t1 FROM odr_order_base t1
WHERE EXISTS (SELECT order_base_id FROM odr_order_commodity WHERE t1.order_base_id = order_base_id AND status IN
<foreach collection="statusList" item="status" separator="," open="(" close=")">
#{status}
</foreach>
AND create_time<![CDATA[ < ]]>#{param.todayStart})
</delete>