Jelajahi Sumber

update:sql优化,一键群发日志添加

ct 1 Minggu lalu
induk
melakukan
91c21e9e05

+ 44 - 0
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -295,6 +295,50 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
             "</script>"})
     List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVO(FsCourseWatchLogStatisticsListParam param);
 
+    @Select({"<script> " +
+            "SELECT COUNT(*) FROM (" +
+            "    SELECT 1 " +
+            "    FROM fs_course_watch_log o " +
+            "    <if test= 'sendType != 1 '> " +
+            "    LEFT JOIN qw_user qu on qu.id = o.qw_user_id " +
+            "    </if> " +
+            "    <if test= 'sendType == 1 '> " +
+            "    LEFT JOIN company_user cu on cu.user_id = o.company_user_id " +
+            "    </if> " +
+            "    WHERE o.company_id = #{companyId} " +
+            "    <if test= 'sendType != null '> " +
+            "        AND o.send_type = #{sendType} " +
+            "    </if> " +
+            "    <if test= 'sTime != null '> " +
+            "        AND o.create_time &gt;= #{sTime} " +
+            "    </if> " +
+            "    <if test='eTime != null '> " +
+            "        AND o.create_time &lt; DATE_ADD(#{eTime}, INTERVAL 1 DAY) " +
+            "    </if> " +
+            "    <if test ='sendType != 1 and nickName != null and nickName != \"\"'> " +
+            "        AND qu.qw_user_name LIKE CONCAT(#{nickName}, '%') " +
+            "    </if> " +
+            "    <if test ='sendType == 1 and nickName != null and nickName != \"\"'> " +
+            "        AND cu.nick_name LIKE CONCAT(#{nickName}, '%') " +
+            "    </if> " +
+            "    <if test ='courseId != null'> " +
+            "        AND o.course_id = #{courseId} " +
+            "    </if> " +
+            "    <if test ='videoId != null'> " +
+            "        AND o.video_id = #{videoId} " +
+            "    </if> " +
+            "    GROUP BY o.video_id, " +
+            "    <if test= 'sendType != 1 '> " +
+            "        o.qw_user_id, " +
+            "    </if> " +
+            "    <if test= 'sendType == 1 '> " +
+            "        o.company_user_id, " +
+            "    </if> " +
+            "    DATE(o.create_time) " +
+            ") t " +
+            "</script>"})
+    Long selectFsCourseWatchLogStatisticsListVOCount(FsCourseWatchLogStatisticsListParam param);
+
 
     ArrayList<FsCourseWatchLogByFinishTimeParam> selectFsCourseWatchLogByFinishTime();
 

+ 2 - 0
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java

@@ -1057,6 +1057,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
                 break;
             case 2:
                 processQwSopLogsBySendMsg(param,param.getDraftStrategy());
+                log.info("一键群发操作日志2:{}", JSON.toJSONString(param));
                 break;
         }
 
@@ -1071,6 +1072,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
         }
         String[] ids = sopUserLogsIds.toArray(new String[0]);
         param.setIds(ids);
+        log.info("一键群发操作日志1:{}", JSON.toJSONString(param));
         processQwSopLogsBySendMsg(param,param.getDraftStrategy());
         return null;
     }