INSERT INTO mall_order (order_no, owner, store_id, fulfillment_type, status, total_amount, discount_amount, tax_amount, surge_amount, pay_amount, receiver_name, receiver_phone, address, delivery_zip, scheduled_date, slot_id, slot_label, card_message, memo, coupon_id) VALUES (#{orderNo}, #{owner}, #{storeId}, COALESCE(#{fulfillmentType},'DELIVERY'), COALESCE(#{status},'PENDING'), #{totalAmount}, COALESCE(#{discountAmount},0), COALESCE(#{taxAmount},0), COALESCE(#{surgeAmount},0), #{payAmount}, #{receiverName}, #{receiverPhone}, #{address}, #{deliveryZip}, #{scheduledDate}, #{slotId}, #{slotLabel}, #{cardMessage}, #{memo}, #{couponId}) UPDATE mall_order SET status = #{status}, updated_at = NOW() WHERE id = #{id} UPDATE mall_order SET proof_photo_url = #{url}, updated_at = NOW() WHERE id = #{id} UPDATE mall_order SET pod_photo_url = #{url}, updated_at = NOW() WHERE id = #{id} INSERT INTO mall_order_item (order_id, product_id, option_id, size_code, product_name, option_label, unit_price, quantity, line_amount) VALUES (#{orderId}, #{productId}, #{optionId}, #{sizeCode}, #{productName}, #{optionLabel}, #{unitPrice}, #{quantity}, #{lineAmount})