From a1d0151dc4be97c829009ed4bff4c4e80806fb60 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 8 Jul 2019 18:38:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90sql][=E4=BF=AE=E6=94=B9][=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0ORDER=E7=B4=A2=E5=BC=95]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V201907081840__G_ALTER_ORDER.sql | 1 + mallinkService/src/main/resources/mapper/WxOrderMapper.xml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V201907081840__G_ALTER_ORDER.sql diff --git a/mallinkAdmin/src/main/resources/db/migration/V201907081840__G_ALTER_ORDER.sql b/mallinkAdmin/src/main/resources/db/migration/V201907081840__G_ALTER_ORDER.sql new file mode 100644 index 000000000..ebbc755c1 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201907081840__G_ALTER_ORDER.sql @@ -0,0 +1 @@ +alter table wx_order add index tenant_product(tenant_id,product_id); \ No newline at end of file diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index 63ce61cf7..395d8f788 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -551,7 +551,7 @@ select o.* from wx_order o where o.type=0 and o.order_status in (0,2,3,1,4) and o.id in( select o.id from wx_order o left join wx_coupon_merchant cm on o.product_id=cm.product_id group by o.id having count(o.id)>1)) o - left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id + left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id where o.tenant_id =#{tenantId} union all select o.id,o.order_number,o.tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.type,o.payment_type,o.payment,o.payment_time, o.order_status,o.create_date,o.update_date,o.detail,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone @@ -561,13 +561,13 @@ select o.id from wx_order o left join wx_coupon_merchant cm on o.product_id=cm.product_id group by o.id having count(o.id)>1) ) o - left join wx_coupon_merchant cm on o.product_id=cm.product_id + left join wx_coupon_merchant cm on o.product_id=cm.product_id where o.tenant_id =#{tenantId} union all select o.*,mbu.merchant_id from wx_order o left join wx_merchant_b_user mbu on o.product_id=mbu.id where o.type in (1,2) and o.order_status in (0,2,3,1,4) ) o left join wx_merchant m on o.merchant_id=m.id - left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id + left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id where o.tenant_id =#{tenantId} ) o