Browse Source

sql优化

zhouzeyu@c-top.com.cn 3 years ago
parent
commit
7bb48ee53f

+ 6 - 2
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialReportOverViewV3Mapper.xml

@@ -621,8 +621,12 @@
         from
         application.kuaishou_material_video_report_daily_dw t1
 
+        left JOIN sys_user t2 on
+        <if test="type == 1"> t1.shot_id =t2.id</if>
+        <if test="type == 2"> t1.clip_id =t2.id</if>
+        <if test="type == 3"> t1.plan_id =t2.id</if>
         <where>
-            t1.stat_date  between #{startDate} and  #{endDate} and t1.company_id=#{companyId}
+            t1.stat_date  between #{startDate} and  #{endDate} and t1.company_id=#{companyId} and t2.status=1
         </where>
         <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and t1.shot_name != ''  GROUP BY t1.shot_id</if>
         <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and t1.clip_name != '' GROUP BY t1.clip_id</if>
@@ -654,7 +658,7 @@
         <if test="type == 3"> t1.plan_id =t2.id</if>
 
         <where>
-            t1.stat_datetime BETWEEN #{startDate} and #{endDate} and t.company_id=#{companyId} and t1.company_id=#{companyId} and t2.del_flag=0
+            t1.stat_datetime BETWEEN #{startDate} and #{endDate} and t.company_id=#{companyId} and t1.company_id=#{companyId} and t2.status=1
         </where>
         <if test="type == 1">AND t1.shot_id is not null and t1.shot_id != '' AND t1.shot_name is not null and t1.shot_name != ''  GROUP BY t1.shot_id</if>
         <if test="type == 2">AND t1.clip_id is not null and t1.clip_id != '' AND t1.clip_name is not null and t1.clip_name != '' GROUP BY t1.clip_id</if>