Pārlūkot izejas kodu

优化查询速度

yumeng 2 gadi atpakaļ
vecāks
revīzija
d66e8f02b5

+ 4 - 3
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -634,9 +634,6 @@
         left join kuaishou_supply_chain t2
         on t1.item_id = t2.item_id
         where 1= 1
-        <if test="userId != null and userId != ''">
-            and t1.user_id = #{userId}
-        </if>
         <if test="start != null and start != ''">
             and t2.order_create_time &gt;= #{start}
         </if>
@@ -644,6 +641,10 @@
             and t2.order_create_time &lt;= #{end}
         </if>
         group by t1.user_id) t
+        where 1 =1
+        <if test="userId != null and userId != ''">
+            and t.user_id = #{userId}
+        </if>
         order by t.orderNum desc
     </select>
     <select id="userItemDetail" resultType="com.alibaba.fastjson.JSONObject">