Эх сурвалжийг харах

statistics add userAttrType

wangming 1 долоо хоног өмнө
parent
commit
7f1af84986

+ 38 - 9
yami-shop-service/src/main/resources/mapper/SkuMapper.xml

@@ -536,17 +536,33 @@
         LEFT JOIN (SELECT a.sku_id,SUM(a.product_count) product_count
         FROM `tz_order_refund_sku` a
         LEFT JOIN tz_order_refund b on a.order_refund_id=b.refund_id
+        LEFT JOIN tz_order c on b.order_number=c.order_number
+        LEFT JOIN tz_sku d on a.sku_id=d.sku_id
+        LEFT JOIN tz_user e on b.user_id=e.user_id
         WHERE return_money_sts=70
-
         <if test="po.startTime != null and po.startTime != ''">
             and b.apply_time&gt;= #{po.startTime}
         </if>
-
         <if test="po.endTime != null and po.endTime != ''">
             and b.apply_time&lt;= #{po.endTime}
         </if>
+        and c.channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="po.skuId != null">
+            AND a.sku_id like concat('%',#{po.skuId} ,'%')
+        </if>
+        <if test="po.skuName != null and po.skuName != ''">
+            AND d.sku_name like concat('%',#{po.skuName} ,'%')
+        </if>
+        <if test="po.spec != null and po.spec != ''">
+            AND d.spec like concat('%',#{po.spec} ,'%')
+        </if>
+        <if test="po.userAttrType != null and po.userAttrType != 0">
+            AND e.user_attr_type=#{po.userAttrType}
+        </if>
         GROUP BY a.sku_id) d on a.sku_id = d.sku_id
-
         WHERE b.is_payed=1
         <if test="po.startTime != null and po.startTime != ''">
             and a.rec_time&gt;= #{po.startTime}
@@ -588,22 +604,37 @@
         LEFT JOIN (SELECT a.sku_id,SUM(a.product_count) product_count
         FROM `tz_order_refund_sku` a
         LEFT JOIN tz_order_refund b on a.order_refund_id=b.refund_id
+        LEFT JOIN tz_order c on b.order_number=c.order_number
+        LEFT JOIN tz_sku d on a.sku_id=d.sku_id
+        LEFT JOIN tz_user e on b.user_id=e.user_id
         WHERE return_money_sts=70
-
         <if test="po.startTime != null and po.startTime != ''">
             and b.apply_time&gt;= #{po.startTime}
         </if>
-
         <if test="po.endTime != null and po.endTime != ''">
             and b.apply_time&lt;= #{po.endTime}
         </if>
+        and c.channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="po.skuId != null">
+            AND a.sku_id like concat('%',#{po.skuId} ,'%')
+        </if>
+        <if test="po.skuName != null and po.skuName != ''">
+            AND d.sku_name like concat('%',#{po.skuName} ,'%')
+        </if>
+        <if test="po.spec != null and po.spec != ''">
+            AND d.spec like concat('%',#{po.spec} ,'%')
+        </if>
+        <if test="po.userAttrType != null and po.userAttrType != 0">
+            AND e.user_attr_type=#{po.userAttrType}
+        </if>
         GROUP BY a.sku_id) d on a.sku_id = d.sku_id
-
         WHERE b.is_payed=1
         <if test="po.startTime != null and po.startTime != ''">
             and a.rec_time&gt;= #{po.startTime}
         </if>
-
         <if test="po.endTime != null and po.endTime != ''">
             and a.rec_time&lt;= #{po.endTime}
         </if>
@@ -614,11 +645,9 @@
         <if test="po.skuId != null">
             AND a.sku_id like concat('%',#{po.skuId} ,'%')
         </if>
-
         <if test="po.skuName != null and po.skuName != ''">
             AND a.sku_name like concat('%',#{po.skuName} ,'%')
         </if>
-
         <if test="po.spec != null and po.spec != ''">
             AND c.spec like concat('%',#{po.spec} ,'%')
         </if>