瀏覽代碼

选品库

zxa 3 年之前
父節點
當前提交
2dbba8ee94

+ 33 - 33
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/material/mapper/xml/ProductMaterialMapper.xml

@@ -113,13 +113,13 @@
         group by t1.product_id,t1.trade_name
     </select>
 
-
     <select id="videoListTotal" resultType="java.lang.Long">
         SELECT IFNULL(sum(1), 0)
         from (
                  select trade_name
                  FROM ctop_product_material
-                 WHERE product_id = #{productId}
+                 WHERE video_url!=''
+                   and product_id = #{productId}
                    and trade_name = #{tradeName}
                    and start_month >= #{startMonth}
                    and end_month &lt;= #{endMonth}
@@ -133,18 +133,19 @@
                t1.trade_name as 'tradeName',
                t1.video_url as 'videoUrl',
                IFNULL(sum(t2.charge), 0.00) as 'charge',
-               (select realname from sys_user where t1.user_id = id) as 'user'
+               IFNULL(t3.realname, '-') as 'user'
         FROM ctop_product_material t1
-                 LEFT JOIN
-             (
-                 SELECT signature, sum(charge) as 'charge'
-                 FROM application.kuaishou_material_video_report_daily_dw
-                 where product_id = #{productId}
-                   AND stat_date >= DATE_FORMAT(#{startDate}, '%Y%m%d')
-                   AND stat_date &lt;= DATE_FORMAT(#{endDate}, '%Y%m%d')
-                 GROUP BY signature
-             ) t2 ON t1.signature = t2.signature
-        WHERE product_id = #{productId}
+                 LEFT JOIN (
+            SELECT signature, sum(charge) as 'charge'
+            FROM application.kuaishou_material_video_report_daily_dw
+            where product_id = #{productId}
+              AND stat_date >= DATE_FORMAT(#{startDate}, '%Y%m%d')
+              AND stat_date &lt;= DATE_FORMAT(#{endDate}, '%Y%m%d')
+            GROUP BY signature
+        ) t2 ON t1.signature = t2.signature
+                 LEFT JOIN (select id, realname from sys_user) t3 on t1.user_id = t3.id
+        WHERE video_url!=''
+        and product_id = #{productId}
           and trade_name = #{tradeName}
           and start_month >= #{startMonth}
           and end_month &lt;= #{endMonth}
@@ -163,11 +164,10 @@
         WHEN 1 THEN '是'
         WHEN 0 THEN '否'
         ELSE '-' END as 'itemRun',
-        (select realname from sys_user where t1.user_id = id) as 'user'
+        IFNULL(t3.realname, '-') as 'user'
         FROM ctop_product_material t1
         LEFT JOIN
-        (
-        SELECT signature , sum(charge) as 'charge' FROM application.kuaishou_material_video_report_daily_dw
+        ( SELECT signature , sum(charge) as 'charge' FROM application.kuaishou_material_video_report_daily_dw
         <where>
             <if test="productId!=null">
                 and product_id = #{productId}
@@ -181,23 +181,23 @@
         </where>
         GROUP BY signature
         ) t2 ON t1.signature = t2.signature
-        <where>
-            <if test="productId!=null">
-                and t1.product_id = #{productId}
-            </if>
-            <if test="tradeName!=null">
-                and t1.trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
-            </if>
-            <if test="startMonth!=null">
-                and t1.start_month >= #{startMonth}
-            </if>
-            <if test="endMonth!=null">
-                and t1.end_month &lt;= #{endMonth}
-            </if>
-            <if test="itemRun!=null">
-                and t1.item_run = #{itemRun}
-            </if>
-        </where>
+        LEFT JOIN (select id, realname from sys_user) t3 on t1.user_id =t3.id
+        where video_url!=''
+        <if test="productId!=null">
+            and t1.product_id = #{productId}
+        </if>
+        <if test="tradeName!=null">
+            and t1.trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
+        </if>
+        <if test="startMonth!=null">
+            and t1.start_month >= #{startMonth}
+        </if>
+        <if test="endMonth!=null">
+            and t1.end_month &lt;= #{endMonth}
+        </if>
+        <if test="itemRun!=null">
+            and t1.item_run = #{itemRun}
+        </if>
         group by t1.signature
     </select>