fix order deliveries

This commit is contained in:
Ubuntu 2022-03-23 05:29:20 +07:00
parent 3692063b63
commit 66db8c2a19
1 changed files with 10 additions and 10 deletions

View File

@ -11,23 +11,23 @@ select
title, title,
status, status,
cast(promotion::json->>'discount' AS numeric) AS discount_value, cast(promotion::json->>'discount' AS numeric) AS discount_value,
cast({{ adapter.quote('delivery') }}::json->>'fee' AS numeric) AS fee, COALESCE(cast({{ adapter.quote('delivery') }}::json->>'fee' AS numeric), 0) AS fee,
{{ adapter.quote('delivery') }}::json->>'note' AS note, {{ adapter.quote('delivery') }}::json->>'note' AS note,
{{ adapter.quote('delivery') }}::json->>'courierName' AS courier_name, {{ adapter.quote('delivery') }}::json->>'courierName' AS courier_name,
{{ adapter.quote('delivery') }}::json->>'serviceName' AS service_name, {{ adapter.quote('delivery') }}::json->>'serviceName' AS service_name,
{{ adapter.quote('delivery') }}::json->>'serviceCode' AS service_code, {{ adapter.quote('delivery') }}::json->>'serviceCode' AS service_code,
{{ adapter.quote('delivery') }}::json->>'currency' AS currency, {{ adapter.quote('delivery') }}::json->>'currency' AS currency,
ISNULL(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'currency' AS numeric), 0) AS feeship_cod, COALESCE(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'currency' AS numeric), 0) AS feeship_cod,
ISNULL(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'insurance' AS numeric), 0) AS feeship_insurance, COALESCE(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'insurance' AS numeric), 0) AS feeship_insurance,
ISNULL(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'shipping' AS numeric), 0) AS feeship_shipping, COALESCE(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'shipping' AS numeric), 0) AS feeship_shipping,
ISNULL(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'total' AS numeric), 0) AS feeship_total, COALESCE(cast({{ adapter.quote('delivery') }}::json->'feeShip'->>'total' AS numeric), 0) AS feeship_total,
cast({{ adapter.quote('delivery') }}::json->>'minDeliveryDay' AS numeric) AS min_delivery_day, COALESCE(cast({{ adapter.quote('delivery') }}::json->>'minDeliveryDay' AS numeric), 0) AS min_delivery_day,
cast({{ adapter.quote('delivery') }}::json->>'maxDeliveryDay' AS numeric) AS max_delivery_day, COALESCE(cast({{ adapter.quote('delivery') }}::json->>'maxDeliveryDay' AS numeric), 0) AS max_delivery_day,
{{ adapter.quote('delivery') }}::json->>'estimateTimeDelivery' AS estimate_time_delivery, {{ adapter.quote('delivery') }}::json->>'estimateTimeDelivery' AS estimate_time_delivery,
service AS service_delivery, service AS service_delivery,
cast({{ adapter.quote('location') }}::json->>'province' AS integer) AS location_province, COALESCE(cast({{ adapter.quote('location') }}::json->>'province' AS integer), 0) AS location_province,
cast({{ adapter.quote('location') }}::json->>'district' AS integer) AS location_district, COALESCE(cast({{ adapter.quote('location') }}::json->>'district' AS integer), 0) AS location_district,
cast({{ adapter.quote('location') }}::json->>'ward' AS integer) AS location_ward, COALESCE(cast({{ adapter.quote('location') }}::json->>'ward' AS integer), 0) AS location_ward,
{{ adapter.quote('location') }}::json->>'address' AS location_address, {{ adapter.quote('location') }}::json->>'address' AS location_address,
{{ adapter.quote('location') }}::json->>'fullAddress' AS location_full_address, {{ adapter.quote('location') }}::json->>'fullAddress' AS location_full_address,
{{ adapter.quote('customer') }}::json->>'name' AS customer_name, {{ adapter.quote('customer') }}::json->>'name' AS customer_name,