diff --git a/src/main/resources/mapper/StatisticsMapper.xml b/src/main/resources/mapper/StatisticsMapper.xml index a149fa8..1ccba5d 100644 --- a/src/main/resources/mapper/StatisticsMapper.xml +++ b/src/main/resources/mapper/StatisticsMapper.xml @@ -25,9 +25,9 @@ select count(1) as count FROM `t_stats_record` r left join `t_stats` s on r.trace_id=s.trace_id - where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId}) - and action = "LOAD" - and identifier = "pages/videoSynthesis/buy" + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) + and action = 'LOAD' + and identifier = 'pages/videoSynthesis/buy' and JSON_EXTRACT(`params`, '$.share') is null <if test="startTime!= null"> and r.create_time >= #{startTime} @@ -45,8 +45,8 @@ select 1 FROM `t_stats_record` r left join `t_stats` s on r.trace_id=s.trace_id - where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId}) - and action = "LAUNCH" + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) + and action = 'LAUNCH' and JSON_EXTRACT(`params`, '$.scene') in (1047,1048,1049) <if test="startTime!= null"> and s.create_time >= #{startTime} @@ -128,8 +128,8 @@ select count(1) as count FROM `t_stats_record` r left join `t_stats` s on r.trace_id=s.trace_id - where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId}) - and action = "PERM_REQ" and identifier = "NOTIFY" + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) + and action = 'PERM_REQ' and identifier = 'NOTIFY' <if test="startTime!= null"> and r.create_time >= #{startTime} </if> @@ -153,30 +153,40 @@ <select id="countUploadFaceOfMember" resultType="java.lang.Integer"> select ifnull(count(1),0) as count from( - select count(1) as count - from face - where scenic_id = #{scenicId} - <if test="startTime!= null">and create_at >= #{startTime}</if> - <if test="endTime!= null">and create_at <= #{endTime}</if> - group by member_id + select 1 as count + from t_stats_record r + left join `t_stats` s on r.trace_id=s.trace_id + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) + and r.action = 'FACE_UPLOAD' + <if test="startTime!= null"> + and s.create_time >= #{startTime} + </if> + <if test="endTime!= null"> + and s.create_time <= #{endTime} + </if> + group by s.member_id ) a </select> <select id="countCompleteVideoOfMember" resultType="java.lang.Integer"> select ifnull(count(1),0) as count from( - select 1 - from video v - left join task t on v.task_id = t.id - left join face f on f.id = t.face_id - where f.scenic_id = #{scenicId} - <if test="startTime!= null"> - and v.create_time >= #{startTime} - </if> - <if test="endTime!= null"> - and v.create_time <= #{endTime} - </if> - group by f.member_id - )a + select 1 from ( + select r.identifier, s.member_id + from t_stats_record r + left join `t_stats` s on r.trace_id=s.trace_id + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) + and r.action = 'FACE_UPLOAD' + <if test="startTime!= null"> + and s.create_time >= #{startTime} + </if> + <if test="endTime!= null"> + and s.create_time <= #{endTime} + </if> + GROUP BY r.identifier, s.member_id + ) stat left join task on task.face_id = stat.identifier and task.`status` = 1 + where task.id is not null + group by stat.member_id + ) a </select> <select id="countTotalVisitorOfMember" resultType="java.lang.Integer"> SELECT @@ -185,7 +195,7 @@ select 1 FROM `t_stats_record` r left join `t_stats` s on r.trace_id=s.trace_id - where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId}) + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) and action = "LAUNCH" <if test="startTime!= null"> and s.create_time >= #{startTime} @@ -197,25 +207,37 @@ ) AS subquery; </select> <select id="countCompleteOfVideo" resultType="java.lang.Integer"> - select count(1) as count - from video - where scenic_id = #{scenicId} + select ifnull(count(1),0) as count + from( + select 1 from ( + select r.identifier, s.member_id + from t_stats_record r + left join `t_stats` s on r.trace_id=s.trace_id + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) + and r.action = 'FACE_UPLOAD' <if test="startTime!= null"> - and create_time >= #{startTime} + and s.create_time >= #{startTime} </if> <if test="endTime!= null"> - and create_time <= #{endTime} + and s.create_time <= #{endTime} </if> + GROUP BY r.identifier, s.member_id + ) stat left join task on task.face_id = stat.identifier and task.`status` = 1 + where task.id is not null + ) a </select> <select id="countPreviewOfVideo" resultType="java.lang.Integer"> SELECT IFNULL(SUM(count), 0) AS count FROM ( - select count(1) as count + select 1 as count FROM `t_stats_record` r left join `t_stats` s on r.trace_id=s.trace_id - where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId}) - and action = "LOAD" and identifier = "pages/videoSynthesis/buy" + where r.trace_id in (select trace_id from `t_stats_record` where action = 'ENTER_SCENIC' and `identifier`=#{scenicId}) + and action = 'LOAD' + and identifier = 'pages/videoSynthesis/buy' + and JSON_EXTRACT(`params`, '$.id') is not null + and JSON_EXTRACT(`params`, '$.share') is null <if test="startTime!= null"> and s.create_time >= #{startTime} </if>