`invoice_id` , `history_order_id`, `history_user_id`, `history_user_type`, `hisotry_serial_number`, `power_price_total`, `service_price_total`, `promotion_discount`, `history_act_price`, `create_time`, `charging_mode`, `charging_station_id`, `terminal_id`, `lock_flag`, `del_flag` insert into xhpc_invoice_map_history_order (invoice_id, history_order_id, history_user_id, history_user_type, hisotry_serial_number, power_price_total, service_price_total, promotion_discount, history_act_price, create_time, charging_mode, charging_station_id, terminal_id, del_flag) values (#{invoiceId,jdbcType=BIGINT}, #{historyOrderId,jdbcType=BIGINT}, #{historyUserId,jdbcType=BIGINT}, #{historyUserType,jdbcType=BIGINT}, #{hisotrySerialNumber,jdbcType=VARCHAR}, #{powerPriceTotal,jdbcType=DECIMAL}, #{servicePriceTotal,jdbcType=DECIMAL}, #{promotionDiscount,jdbcType=DECIMAL}, #{historyActPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{chargingMode,jdbcType=VARCHAR}, #{chargingStationId,jdbcType=BIGINT}, #{terminalId,jdbcType=BIGINT}, #{delFlag,jdbcType=INTEGER}) insert into xhpc_invoice_map_history_order invoice_id, history_order_id, history_user_id, history_user_type, hisotry_serial_number, power_price_total, service_price_total, promotion_discount, history_act_price, create_time, charging_mode, charging_station_id, terminal_id, lock_flag, del_flag, #{invoiceId,jdbcType=BIGINT}, #{historyOrderId,jdbcType=BIGINT}, #{historyUserId,jdbcType=BIGINT}, #{historyUserType,jdbcType=BIGINT}, #{hisotrySerialNumber,jdbcType=VARCHAR}, #{powerPriceTotal,jdbcType=DECIMAL}, #{servicePriceTotal,jdbcType=DECIMAL}, #{promotionDiscount,jdbcType=DECIMAL}, #{historyActPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{chargingMode,jdbcType=VARCHAR}, #{chargingStationId,jdbcType=BIGINT}, #{terminalId,jdbcType=BIGINT}, #{lockFlag,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER}, update xhpc_invoice_map_history_order set lock_flag = 0 where history_order_id in ( (SELECT middle.history_order_id from (select history_order_id from xhpc_invoice_map_history_order where invoice_id = #{invoiceId}) as middle ) ) UPDATE xhpc_invoice_map_history_order SET lock_flag = NULL WHERE invoice_id = #{invoiceId}