yuhongqi 6 дней назад
Родитель
Сommit
6e858867e9

+ 13 - 5
fs-service/src/main/resources/mapper/qw/QwRestrictionPushRecordMapper.xml

@@ -14,11 +14,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <select id="selectFastgptPushTokenTotal" resultType="com.fs.fastGpt.domain.FastGptPushTokenTotal">
-        select id,`type`,qw_user_id as qwUserId,company_id as companyId,status,date_format(create_time,'%Y-%m-%d') as statTime,count(id) count
+        select `type`,
+               qw_user_id as qwUserId,
+               company_id as companyId,
+               1 as status,
+               #{createTime} as statTime,
+               count(id) as count
         from qw_restriction_push_record
-        where  create_time like concat(#{createTime}, '%') and qw_user_id is not null and status = 1
-        GROUP BY `type`,company_id,qw_user_id
-        ORDER BY `type`,company_id,qw_user_id
+        where create_time >= concat(#{createTime}, ' 00:00:00')
+          and create_time &lt;= concat(#{createTime}, ' 23:59:59')
+          and qw_user_id is not null
+          and status = 1
+        group by `type`, company_id, qw_user_id
+        order by `type`, company_id, qw_user_id
     </select>
 
     <select id="selectFastGptPushTokenTotalByInfo" resultType="com.fs.fastGpt.domain.FastGptPushTokenTotal">
@@ -72,4 +80,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         group by t4.dept_id,ft.stat_time
     </select>
-</mapper>
+</mapper>

+ 3 - 5
fs-service/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml

@@ -331,14 +331,12 @@
         COUNT(DISTINCT a.user_id) AS answer_user_count,
         COUNT(DISTINCT CASE WHEN a.is_right = 1 THEN a.user_id END) AS correct_user_count
         FROM fs_course_watch_log w
-        LEFT JOIN fs_course_answer_logs a ON w.video_id = a.video_id AND w.user_id = a.user_id
+        LEFT JOIN fs_course_answer_logs a ON a.watch_log_id = w.log_id
         <where>
             <if test="startTime != null">w.create_time <![CDATA[>=]]> #{startTime}</if>
             <if test="endTime != null">AND w.create_time <![CDATA[<]]> #{endTime}</if>
             <if test="userType != null">AND w.send_type = #{userType}</if>
             <if test="companyId != null">AND w.company_id = #{companyId}</if>
-<!--            <if test="startTime != null">AND a.create_time <![CDATA[>=]]> #{startTime}</if> -->
-<!--            <if test="endTime != null">AND a.create_time <![CDATA[<]]> #{endTime}</if> -->
         </where>
         GROUP BY w.course_id
         ORDER BY answer_user_count
@@ -358,7 +356,7 @@
         COUNT(DISTINCT a.user_id) AS answer_user_count,
         COUNT(DISTINCT CASE WHEN a.is_right = 1 THEN a.user_id END) AS correct_user_count
         FROM fs_course_watch_log w
-        LEFT JOIN fs_course_answer_logs a ON w.video_id = a.video_id AND w.user_id = a.user_id
+        LEFT JOIN fs_course_answer_logs a ON a.watch_log_id = w.log_id
         <where>
             <if test="startTime != null">w.create_time <![CDATA[>=]]> #{startTime}</if>
             <if test="endTime != null">AND w.create_time <![CDATA[<]]> #{endTime}</if>
@@ -383,7 +381,7 @@
         COUNT(DISTINCT a.user_id) AS answer_user_count,
         COUNT(DISTINCT CASE WHEN a.is_right = 1 THEN a.user_id END) AS correct_user_count
         FROM fs_course_answer_logs a
-        INNER JOIN fs_course_watch_log w ON a.video_id = w.video_id AND a.user_id = w.user_id
+        INNER JOIN fs_course_watch_log w ON a.watch_log_id = w.log_id
         <where>
             w.course_id IN
             <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">