CREATE TABLE t_equipment_charge_order (
    id Int64,
    user_id Int64,
    company_id Nullable(Int64),
    station_id Nullable(Int64),
    equipment_id Int64,
    connector_id Int64,
    user_card_no Nullable(String),
    state Nullable(Int8),
    operate_state Nullable(Int8),
    order_no String,
    platform_order_no Nullable(String),
    platform_sale_type Nullable(Int8),
    platform_driver_id Nullable(String),
    platform_phone Nullable(String),
    charging_amt Nullable(Decimal(20,2)),
    order_type Nullable(Int8),
    order_time Nullable(DateTime),
    charge_begin_time Nullable(DateTime),
    charge_end_time Nullable(DateTime),
    charge_begin_degree Nullable(Float64),
    charge_end_degree Nullable(Float64),
    charge_degree Nullable(Float64),
    charge_ah Nullable(Float64),
    charge_times_degree Nullable(String),
    charge_begin_soc Nullable(Int32),
    charge_end_soc Nullable(Int32),
    charge_cur_soc Nullable(Int32),
    charge_duration Nullable(Int32),
    charge_settle_type Nullable(Int8),
    charge_unit_price Nullable(Decimal(10,7)),
    charge_unit_cost Nullable(Decimal(10,7)),
    charge_unit_service_fee Nullable(Decimal(20,7)),
    receivable_electric_fee Nullable(Decimal(20,7)),
    receivable_service_fee Nullable(Decimal(20,7)),
    receivable_total_fee Nullable(Decimal(20,7)),
    charge_elecfee_amount Nullable(Decimal(20,7)),
    charge_elecfee_cost_amount Nullable(Decimal(20,7)),
    charge_service_amount Nullable(Decimal(20,7)),
    actual_pay_amount Nullable(Decimal(20,2)),
    pay_order_no Nullable(String),
    pay_amount Nullable(Decimal(20,2)),
    pay_method Nullable(Int8),
    pay_status Nullable(Int8),
    pay_time Nullable(DateTime),
    user_coupon_id Nullable(Int64),
    coupon_name Nullable(String),
    coupon_type Nullable(Int8),
    coupon_amount Nullable(Decimal(20,2)),
    elecfee_coupon_amount Nullable(Decimal(20,2)),
    servicefee_coupon_amount Nullable(Decimal(20,2)),
    invoice_id Nullable(Int64),
    invoice_fee Nullable(Decimal(20,2)),
    ticket_status Nullable(Int8),
    activity_electric_fee Nullable(Decimal(20,7)),
    activity_service_fee Nullable(Decimal(20,2)),
    charge_plate_no Nullable(String),
    charge_vin Nullable(String),
    charge_strategy Nullable(String),
    charge_strategy_param Nullable(String),
    operator_id Nullable(Int64),
    operator_income Nullable(Decimal(20,2)),
    plat_service_fee Nullable(Decimal(20,2)),
    charge_discount_type Nullable(Int8),
    settle_electric_fee Nullable(Decimal(20,2)),
    settle_service_fee Nullable(Decimal(20,2)),
    settle_fee Nullable(Decimal(20,2)),
    settle_method Nullable(Int8),
    settle_coupon_amount Nullable(Decimal(20,2)),
    settle_coupon_electric_fee Nullable(Decimal(20,2)),
    settle_coupon_service_fee Nullable(Decimal(20,2)),
    settle_status Nullable(Int8),
    cancel_type Nullable(Int32),
    cancel_code Nullable(Int32),
    cancel_msg Nullable(String),
    cancel_time Nullable(DateTime),
    finish_type Nullable(Int32),
    finish_code Nullable(Int32),
    finish_msg Nullable(String),
    finish_time Nullable(DateTime),
    boot_mode Nullable(Int8),
    settlement_type Nullable(Int8),
    is_parking_coupon Nullable(Int8),
    control_source Nullable(String),
    exception_flag Nullable(Int8),
    exception_msg Nullable(String),
    report_time Nullable(DateTime),
    com_service_fee Nullable(Decimal(10,2)),
    com_electric_fee Nullable(Decimal(10,2)),
    com_total_fee Nullable(Decimal(10,2)),
    com_charge_discount_type Nullable(Int8),
    com_charge_discount Nullable(Float64),
    has_shallow_report Nullable(Int8),
    has_deep_report Nullable(Int8),
    is_exception Nullable(Int8),
    shallow_report_is_received Nullable(Int8),
    create_time Nullable(DateTime),
    update_time Nullable(DateTime),
    charge_market_id Nullable(Int64),
    coupon_total_amount Decimal(20,2),
    coupon_service_total_amount Decimal(20,2),
    coupon_elecfee_total_amount Decimal(20,2),
    activity_name String,
    activity_total_fee Decimal(20,2),
    company_activity_id Nullable(Int64),
    company_activity_name Nullable(String),
    company_activity_total_fee Decimal(20,2),
    company_activity_service_fee Decimal(20,2),
    company_activity_electric_fee Decimal(20,7),
    subsidy_degree Decimal(20,3),
    subsidy_fee Decimal(20,2),
    special_channel_order_source Nullable(Int8),
    INDEX idx_uounique (equipment_id, charge_begin_time, charge_end_time, connector_id) TYPE minmax GRANULARITY 3,
    INDEX id (id) TYPE minmax GRANULARITY 3,
    INDEX order_no (order_no) TYPE minmax GRANULARITY 3,
    INDEX user_coupon_id (user_coupon_id) TYPE minmax GRANULARITY 3,
    INDEX user_id (user_id) TYPE minmax GRANULARITY 3,
    INDEX user_card_no (user_card_no) TYPE minmax GRANULARITY 3,
    INDEX INDEX_ORDER_TIME (order_time) TYPE minmax GRANULARITY 3,
    INDEX station_id (station_id) TYPE minmax GRANULARITY 3,
    INDEX exception_flag (exception_flag) TYPE minmax GRANULARITY 3,
    INDEX state (state) TYPE minmax GRANULARITY 3,
    INDEX idx_state_reporttime (state, report_time) TYPE minmax GRANULARITY 3,
    INDEX idx_actualpayamount_userid (user_id, actual_pay_amount) TYPE minmax GRANULARITY 3,
    INDEX idx_stationid_state_chargeendtime_chargebeginsoc (station_id, state, charge_end_time, charge_begin_soc) TYPE minmax GRANULARITY 3,
    INDEX idx_e40168caafb4d724214ad41b4d52b666 (charge_end_time, state, pay_status, actual_pay_amount, charge_degree, station_id) TYPE minmax GRANULARITY 3,
    INDEX create_time (create_time) TYPE minmax GRANULARITY 3,
    INDEX index_company_id (company_id) TYPE minmax GRANULARITY 3,
    INDEX vin (charge_vin) TYPE minmax GRANULARITY 3,
    INDEX idx_reporttime (report_time) TYPE minmax GRANULARITY 3,
    INDEX idx_state_chargedegree (state, charge_degree) TYPE minmax GRANULARITY 3,
    INDEX idx_stationid_chargedegree (station_id, charge_degree) TYPE minmax GRANULARITY 3,
    INDEX platform_order_no (platform_order_no) TYPE minmax GRANULARITY 3,
    INDEX idx_cover_condition (station_id, report_time, state, charge_degree) TYPE minmax GRANULARITY 3
) ENGINE = ReplacingMergeTree()
ORDER BY (id)
SETTINGS index_granularity = 8192;