select zhho.id, zhho.hotel_homestay_id, zhho.order_code, zhho.order_source, zhho.contact_mobile, zhho.contact_names, zhho.stay_type, zhho.in_datetime, zhho.out_datetime, zhho.estimated_arrival_time, zhho.estimated_arrival_date_time, zhho.stay_status, zhho.room_quantity, zhho.room_classify_id, zhho.room_price, zhho.room_charge, zhho.room_consumption, zhho.penalty_fee, zhho.refund, zhho.total_amount, zhho.balance_status, zhho.block_booking_status, zhho.payment_type, zhho.payment_method, zhho.payment_scene, zhho.payment_time, zhho.order_prepay_id, zhho.trade_session, zhho.refund_status, zhho.refund_time, zhho.cancel_time, zhho.create_time, zhho.create_zdy_user_id, zhho.create_sys_user_id, zhho.update_time, zhho.updater_id, zhho.is_deleted, zhho.processed_by, zhho.processing_time, zhho.remark, zhho.pay_amount, zhho.coupon_amount, zhho.coupon_id, zhho.actual_check_in_time, zhho.actual_check_out_time, sbi.name as hotel_homestay_name, sbi.images as hotel_homestay_cover_image, sbi.longitude as hotel_homestay_longitude, sbi.latitude as hotel_homestay_latitude, sbi.contact_phone as hotel_homestay_phonenumber, processed_by_user.nick_name as processed_by_user_name from zdy_hotel_homestay_order zhho left join zdy_hotel_homestay zhh on zhho.hotel_homestay_id = zhh.id left join zdy_store_base_info sbi on sbi.id = zhh.store_id left join sys_user processed_by_user on zhho.processed_by = processed_by_user.user_id insert into zdy_hotel_homestay_order hotel_homestay_id, order_code, order_source, contact_mobile, contact_names, stay_type, in_datetime, out_datetime, estimated_arrival_time, estimated_arrival_date_time, stay_status, room_quantity, room_classify_id, room_price, room_charge, room_consumption, penalty_fee, refund, total_amount, balance_status, block_booking_status, payment_type, payment_method, payment_scene, payment_time, order_prepay_id, trade_session, refund_status, refund_time, cancel_time, create_time, create_zdy_user_id, create_sys_user_id, update_time, updater_id, is_deleted, remark, processed_by, processing_time, pay_amount, coupon_amount, coupon_id, actual_check_in_time, actual_check_out_time, #{hotelHomestayId}, #{orderCode}, #{orderSource}, #{contactMobile}, #{contactNames}, #{stayType}, #{inDateTime}, #{outDateTime}, #{estimatedArrivalTime}, #{estimatedArrivalDateTime}, #{stayStatus}, #{roomQuantity}, #{roomClassifyId}, #{roomPrice}, #{roomCharge}, #{roomConsumption}, #{penaltyFee}, #{refund}, #{totalAmount}, #{balanceStatus}, #{blockBookingStatus}, #{paymentType}, #{paymentMethod}, #{paymentScene}, #{paymentTime}, #{orderPrepayId}, #{tradeSession}, #{refundStatus}, #{refundTime}, #{cancelTime}, #{createTime}, #{createZdyUserId}, #{createSysUserId}, #{updateTime}, #{updaterId}, #{isDeleted}, #{remark}, #{processedBy}, #{processingTime}, #{payAmount}, #{couponAmount}, #{couponId}, #{actualCheckInTime}, #{actualCheckOutTime}, update zdy_hotel_homestay_order hotel_homestay_id = #{hotelHomestayId}, order_code = #{orderCode}, order_source = #{orderSource}, contact_mobile = #{contactMobile}, contact_names = #{contactNames}, stay_type = #{stayType}, in_datetime = #{inDateTime}, out_datetime = #{outDateTime}, estimated_arrival_time = #{estimatedArrivalTime}, estimated_arrival_date_time = #{estimatedArrivalDateTime}, stay_status = #{stayStatus}, room_quantity = #{roomQuantity}, room_classify_id = #{roomClassifyId}, room_price = #{roomPrice}, room_charge = #{roomCharge}, room_consumption = #{roomConsumption}, penalty_fee = #{penaltyFee}, refund = #{refund}, total_amount = #{totalAmount}, balance_status = #{balanceStatus}, block_booking_status = #{blockBookingStatus}, payment_type = #{paymentType}, payment_method = #{paymentMethod}, payment_scene = #{paymentScene}, payment_time = #{paymentTime}, order_prepay_id = #{orderPrepayId}, trade_session = #{tradeSession}, refund_status = #{refundStatus}, refund_time = #{refundTime}, cancel_time = #{cancelTime}, create_time = #{createTime}, create_zdy_user_id = #{createZdyUserId}, create_sys_user_id = #{createSysUserId}, update_time = #{updateTime}, updater_id = #{updaterId}, is_deleted = #{isDeleted}, remark = #{remark}, processed_by = #{processedBy}, processing_time = #{processingTime}, pay_amount = #{payAmount}, coupon_amount = #{couponAmount}, coupon_id = #{couponId}, `actual_check_in_time` = CASE WHEN ISNULL(actual_check_in_time) THEN #{actualCheckInTime} ELSE `actual_check_in_time` END, actual_check_out_time = #{actualCheckOutTime}, where id = #{id} update zdy_hotel_homestay_order set is_deleted = 1 where id in #{id} update zdy_hotel_homestay_order hotel_homestay_id = #{hotelHomestayId}, order_source = #{orderSource}, contact_mobile = #{contactMobile}, contact_names = #{contactNames}, stay_type = #{stayType}, in_datetime = #{inDateTime}, out_datetime = #{outDateTime}, estimated_arrival_time = #{estimatedArrivalTime}, estimated_arrival_date_time = #{estimatedArrivalDateTime}, stay_status = #{stayStatus}, room_quantity = #{roomQuantity}, room_classify_id = #{roomClassifyId}, room_price = #{roomPrice}, room_charge = #{roomCharge}, room_consumption = #{roomConsumption}, penalty_fee = #{penaltyFee}, refund = #{refund}, total_amount = #{totalAmount}, balance_status = #{balanceStatus}, block_booking_status = #{blockBookingStatus}, payment_type = #{paymentType}, payment_method = #{paymentMethod}, payment_scene = #{paymentScene}, payment_time = #{paymentTime}, order_prepay_id = #{orderPrepayId}, trade_session = #{tradeSession}, refund_status = #{refundStatus}, refund_time = #{refundTime}, cancel_time = #{cancelTime}, create_time = #{createTime}, create_zdy_user_id = #{createZdyUserId}, create_sys_user_id = #{createSysUserId}, update_time = #{updateTime}, updater_id = #{updaterId}, is_deleted = #{isDeleted}, remark = #{remark}, processed_by = #{processedBy}, processing_time = #{processingTime}, pay_amount = #{payAmount}, coupon_amount = #{couponAmount}, coupon_id = #{couponId}, `actual_check_in_time` = CASE WHEN ISNULL(actual_check_in_time) THEN #{actualCheckInTime} ELSE `actual_check_in_time` END, actual_check_out_time = #{actualCheckOutTime}, where order_code = #{orderCode}