zoujiajian 10 luni în urmă
părinte
comite
2328a49cc4
1 a modificat fișierele cu 22 adăugiri și 23 ștergeri
  1. 22 23
      netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

+ 22 - 23
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -536,33 +536,32 @@
         </if>
     </select>
 
-    <select id="getDistributeOrderView"
-            resultType="com.cyksj.model.views.DistributeOrderStatisticsDataView">
+    <select id="getDistributeOrderView" resultType="com.cyksj.model.views.DistributeOrderStatisticsDataView">
         select user_id, goods_id, nickname, `date`, money
         from (
-            select us.shared_id as user_id,
-            o.goods_id,
-            (select nickname from `user` where id = us.shared_id limit 1) as nickname,
-            date_format(o.created_time,'%Y-%m-%d') `date`,
-            sum(money)/100 as money,
-            row_number() over (partition by date_format(o.created_time,'%Y-%m-%d') order by sum(money) desc) as rn
-            from user_distribute_shared us
-            <if test="isGeneral != null">
-                left join user_distribute ud on ud.user_id = us.shared_id and ud.deleted
+        select us.shared_id as user_id,
+        o.goods_id,
+        (select nickname from `user` where id = us.shared_id limit 1) as nickname,
+        date_format(o.created_time,'%Y-%m-%d') `date`,
+        sum(money)/100 as money,
+        row_number() over (partition by date_format(o.created_time,'%Y-%m-%d') order by sum(money) desc) as rn
+        from user_distribute_shared us
+        <if test="isGeneral != null">
+            left join user_distribute ud on ud.user_id = us.shared_id and ud.deleted
+        </if>
+        inner join order_don o on o.user_Id = us.user_id
+        where o.`status` not in ('close','noPayment','refund')
+        and o.created_time BETWEEN #{start} and #{end}
+        and o.goods_id = #{goodsId} and o.is_fixed_distribute
+        <if test="isGeneral != null">
+            <if test="isGeneral">
+                and ud.id is null
             </if>
-            inner join order_don o on o.user_Id = us.user_id
-            where o.`status` not in ('close','noPayment','refund')
-            and o.created_time BETWEEN #{start} and #{end}
-            and o.goods_id = #{goodsId} and o.is_fixed_distribute
-            <if test="isGeneral != null">
-                <if test="isGeneral">
-                    and ud.id is null
-                </if>
-                <if test="!isGeneral">
-                    and ud.id is not null
-                </if>
+            <if test="!isGeneral">
+                and ud.id is not null
             </if>
-            group by us.shared_id,o.goods_id,date_format(o.created_time,'%Y-%m-%d')
+        </if>
+        group by us.shared_id,o.goods_id,date_format(o.created_time,'%Y-%m-%d')
         ) ranked
         where rn &lt;= 5
         order by `date` asc, money desc