Explorar o código

设计人员报表标签素材查询sql优化

zhaoxian %!s(int64=4) %!d(string=hai) anos
pai
achega
a1e9edc79f

+ 33 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -461,6 +461,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
         GROUP BY t1.user_id
@@ -503,6 +506,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
         GROUP BY t1.user_id
@@ -531,6 +537,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60155
@@ -560,6 +569,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id = 60155
         GROUP BY t1.user_id,t1.`code`
@@ -590,6 +602,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60156
@@ -619,6 +634,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE  t2.parent_id = 60156
         GROUP BY t1.user_id,t1.`code`
@@ -670,6 +688,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id in(60155,60156)
         GROUP BY t1.user_id
@@ -699,6 +720,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60155
@@ -728,6 +752,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id = 60155
         GROUP BY t1.user_id,t1.`code`
@@ -758,6 +785,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         LEFT JOIN ctop_kuaishou_report_daily_material t5 ON  t1.`code` = t5.signature
         WHERE t2.parent_id = 60156
@@ -787,6 +817,9 @@
         <if test="roleCode!=null">
             AND tt3.role_code = #{roleCode}
         </if>
+        <if test="roleCode==null">
+            AND tt3.role_code in ('clip','shot','plan')
+        </if>
         ) t3 ON t3.id = t1.user_id
         WHERE t2.parent_id = 60156
         GROUP BY t1.user_id,t1.`code`