Browse Source

订单查询 Using join buffer (Block Nested Loop)问题优化

wanxl 1 năm trước cách đây
mục cha
commit
12ad361e50
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/main/resources/mapper/order/OrderMapper.xml

+ 2 - 2
src/main/resources/mapper/order/OrderMapper.xml

@@ -86,7 +86,8 @@
         shopPhone,
         tiu.user_name as riderNickName,tiu.phone as riderPhone,ti.indent_id as indentId,ti.is_rider as isRider,
         ti.rider_user_id as riderUserId, tcu.money as couponMoney,
-        apr.discount_amount as activityDiscountAmount, ai.title activityTitle,tiu.rider_station_id as riderStationId,rs.station_name as stationName
+        apr.discount_amount as activityDiscountAmount, ai.title activityTitle,tiu.rider_station_id as riderStationId,
+        (select rs.station_name from rider_station rs where  rs.id =tiu.rider_station_id ) as stationName
         from tb_order tor
         left join tb_user tu on tor.user_id = tu.user_id
         left join goods_shop gs on tor.shop_id = gs.shop_id
@@ -95,7 +96,6 @@
         left join tb_coupon_user tcu on tor.coupon_id = tcu.id
         left join activity_part_record apr on apr.order_id = tor.order_id
         left join activity ai on ai.id = apr.activity_id
-        left join rider_station rs on tiu.rider_station_id = rs.id
         where 1 = 1
         <if test="riderPhone!=null and riderPhone!=''">
             and tiu.phone =#{riderPhone}