select oi.order_id, oi.device_order_id, oi.device_sn, oi.device_num, oi.user_id, oi.identity_verification, oi.source_type, oi.is_online, oi.canteen_id, ac.canteen_name, oi.stall_id, ast.stall_name, oi.mealtime_type, oi.mealtime_name, oi.order_date, oi.payable_amount, oi.discounts_amount, oi.real_amount, oi.account_pay_amount, oi.external_pay_amount, oi.refund_amount, oi.order_time, oi.order_type, oi.order_state, oi.order_refund_state, oi.deduction_type, oi.pay_time, oi.pay_type, oi.pay_channel, oi.pay_state, oi.pay_param, oi.delivery_amount, oi.packing_amount, oi.delivery_type, oi.comment_state, oi.remark, di.device_name, su.nick_name, oi.create_by, oi.create_time, oi.update_by, oi.update_time, su.phonenumber as phoneNumber, sd.dept_full_name, aa.area_name from order_info oi left join alloc_canteen ac on ac.canteen_id = oi.canteen_id left join alloc_stall ast on ast.stall_id = oi.stall_id left join alloc_area aa on aa.area_id = ac.area_id left join sys_user su on oi.user_id = su.user_id left join sys_dept sd on sd.dept_id = su.dept_id left join device_info di on oi.device_sn = di.device_sn insert into order_info order_id, device_order_id, device_sn, device_num, user_id, identity_verification, source_type, is_online, canteen_id, stall_id, mealtime_type, mealtime_name, order_date, payable_amount, discounts_amount, real_amount, account_pay_amount, external_pay_amount, refund_amount, order_time, order_type, order_state, order_refund_state, deduction_type, pay_time, pay_type, pay_channel, pay_state, pay_param, delivery_amount, packing_amount, delivery_type, comment_state, remark, create_by, create_time, update_by, update_time, #{orderId}, #{deviceOrderId}, #{deviceSn}, #{deviceNum}, #{userId}, #{identityVerification}, #{sourceType}, #{isOnline}, #{canteenId}, #{stallId}, #{mealtimeType}, #{mealtimeName}, #{orderDate}, #{payableAmount}, #{discountsAmount}, #{realAmount}, #{accountPayAmount}, #{externalPayAmount}, #{refundAmount}, #{orderTime}, #{orderType}, #{orderState}, #{orderRefundState}, #{deductionType}, #{payTime}, #{payType}, #{payChannel}, #{payState}, #{payParam}, #{deliveryAmount}, #{packingAmount}, #{deliveryType}, #{commentState}, #{remark}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, insert into order_info ( order_id, device_order_id, device_sn, device_num, user_id, identity_verification, source_type, is_online, canteen_id, stall_id, mealtime_type, mealtime_name, order_date, payable_amount, discounts_amount, real_amount, account_pay_amount, external_pay_amount, refund_amount, order_time, order_type, order_state, order_refund_state, deduction_type, pay_time, pay_type, pay_channel, pay_state, pay_param, delivery_amount, packing_amount, delivery_type, comment_state, remark, create_by, update_by ) values ( #{orderInfo.orderId}, #{orderInfo.deviceOrderId}, #{orderInfo.deviceSn}, #{orderInfo.deviceNum}, #{orderInfo.userId}, #{orderInfo.identityVerification}, #{orderInfo.sourceType}, #{orderInfo.isOnline}, #{orderInfo.canteenId}, #{orderInfo.stallId}, #{orderInfo.mealtimeType}, #{orderInfo.mealtimeName}, #{orderInfo.orderDate}, #{orderInfo.payableAmount}, #{orderInfo.discountsAmount}, #{orderInfo.realAmount}, #{orderInfo.accountPayAmount}, #{orderInfo.externalPayAmount}, #{orderInfo.refundAmount}, #{orderInfo.orderTime}, #{orderInfo.orderType}, #{orderInfo.orderState}, #{orderInfo.orderRefundState}, #{orderInfo.deductionType}, #{orderInfo.payTime}, #{orderInfo.payType}, #{orderInfo.payChannel}, #{orderInfo.payState}, #{orderInfo.payParam}, #{orderInfo.deliveryAmount}, #{orderInfo.packingAmount}, #{orderInfo.deliveryType}, #{orderInfo.commentState}, #{orderInfo.remark}, #{orderInfo.createBy}, #{orderInfo.updateBy} ) update order_info device_order_id = #{deviceOrderId}, device_sn = #{deviceSn}, device_num = #{deviceNum}, user_id = #{userId}, identity_verification = #{identityVerification}, source_type = #{sourceType}, is_online = #{isOnline}, canteen_id = #{canteenId}, stall_id = #{stallId}, mealtime_type = #{mealtimeType}, mealtime_name = #{mealtimeName}, order_date = #{orderDate}, payable_amount = #{payableAmount}, discounts_amount = #{discountsAmount}, real_amount = #{realAmount}, account_pay_amount = #{accountPayAmount}, external_pay_amount = #{externalPayAmount}, refund_amount = #{refundAmount}, order_time = #{orderTime}, order_type = #{orderType}, order_state = #{orderState}, order_refund_state = #{orderRefundState}, deduction_type = #{deductionType}, pay_time = #{payTime}, pay_type = #{payType}, pay_channel = #{payChannel}, pay_state = #{payState}, pay_param = #{payParam}, delivery_amount = #{deliveryAmount}, packing_amount = #{packingAmount}, delivery_type = #{deliveryType}, comment_state = #{commentState}, remark = #{remark}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, where order_id = #{orderId} update order_info set account_pay_amount = #{param.payAmount}, pay_state = #{param.payState}, update_by = #{param.updateBy}, order_state = #{param.orderState}, pay_time = #{param.payTime}, update_time = #{param.updateTime} where order_id in #{orderId} delete from order_info where order_id = #{orderId} delete from order_info where order_id in #{orderId} update order_info set order_state = 2 where order_id in #{orderId}