Просмотр исходного кода

【sql][修改][添加ORDER索引]

release_toaliyun_real
gongbiao 6 лет назад
Родитель
Сommit
a1d0151dc4
2 измененных файлов: 4 добавлений и 3 удалений
  1. +1
    -0
      mallinkAdmin/src/main/resources/db/migration/V201907081840__G_ALTER_ORDER.sql
  2. +3
    -3
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml

+ 1
- 0
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);

+ 3
- 3
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
<where>
<if test="tenantId!=null">


Загрузка…
Отмена
Сохранить