统计调整

This commit is contained in:
2025-04-27 04:35:32 +08:00
parent bb26fa43bf
commit 7583c9e22e

View File

@ -23,23 +23,19 @@
IFNULL(count(1), 0) AS count IFNULL(count(1), 0) AS count
FROM ( FROM (
select count(1) as count select count(1) as count
from statistics FROM `t_stats_record` r
where type=2 and scenic_id = #{scenicId} 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"
and JSON_EXTRACT(`params`, '$.share') is null
<if test="startTime!= null"> <if test="startTime!= null">
and create_time >= #{startTime} and r.create_time >= #{startTime}
</if> </if>
<if test="endTime!= null"> <if test="endTime!= null">
and create_time &lt;= #{endTime} and r.create_time &lt;= #{endTime}
</if> </if>
and morph_id is not null group by s.member_id
and member_id in (select member_id from statistics where type = 10
<if test="startTime!= null">
and create_time >= #{startTime}
</if>
<if test="endTime!= null">
and create_time &lt;= #{endTime}
</if>)
group by member_id
)a )a
</select> </select>
<select id="countScanCodeOfMember" resultType="java.lang.Integer"> <select id="countScanCodeOfMember" resultType="java.lang.Integer">
@ -47,15 +43,18 @@
IFNULL(count(1), 0) AS count IFNULL(count(1), 0) AS count
FROM ( FROM (
select 1 select 1
from statistics FROM `t_stats_record` r
where type=10 and morph_id in (1047,1048,1049) and scenic_id = #{scenicId} 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"
and JSON_EXTRACT(`params`, '$.scene') in (1047,1048,1049)
<if test="startTime!= null"> <if test="startTime!= null">
and create_time >= #{startTime} and s.create_time >= #{startTime}
</if> </if>
<if test="endTime!= null"> <if test="endTime!= null">
and create_time &lt;= #{endTime} and s.create_time &lt;= #{endTime}
</if> </if>
group by member_id group by s.member_id
) AS subquery; ) AS subquery;
</select> </select>
<select id="countClickPayOfMember" resultType="java.lang.Integer"> <select id="countClickPayOfMember" resultType="java.lang.Integer">
@ -127,22 +126,17 @@
IFNULL(count(1), 0) AS count IFNULL(count(1), 0) AS count
FROM ( FROM (
select count(1) as count select count(1) as count
from statistics FROM `t_stats_record` r
where type=6 and scenic_id = #{scenicId} 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"
<if test="startTime!= null"> <if test="startTime!= null">
and create_time >= #{startTime} and r.create_time >= #{startTime}
</if> </if>
<if test="endTime!= null"> <if test="endTime!= null">
and create_time &lt;= #{endTime} and r.create_time &lt;= #{endTime}
</if> </if>
and member_id in (select member_id from statistics where type = 10 group by s.member_id
<if test="startTime!= null">
and create_time >= #{startTime}
</if>
<if test="endTime!= null">
and create_time &lt;= #{endTime}
</if>)
group by member_id
)a )a
</select> </select>
<select id="countCameraShotOfMember" resultType="java.lang.Integer"> <select id="countCameraShotOfMember" resultType="java.lang.Integer">
@ -164,30 +158,22 @@
where scenic_id = #{scenicId} where scenic_id = #{scenicId}
<if test="startTime!= null">and create_at >= #{startTime}</if> <if test="startTime!= null">and create_at >= #{startTime}</if>
<if test="endTime!= null">and create_at &lt;= #{endTime}</if> <if test="endTime!= null">and create_at &lt;= #{endTime}</if>
and member_id in (select member_id from statistics where type = 10
<if test="startTime!= null">
and create_time >= #{startTime}
</if>
<if test="endTime!= null">
and create_time &lt;= #{endTime}
</if>)
group by member_id group by member_id
) a ) a
</select> </select>
<select id="countCompleteVideoOfMember" resultType="java.lang.Integer"> <select id="countCompleteVideoOfMember" resultType="java.lang.Integer">
select ifnull(count(1),0) as count select ifnull(count(1),0) as count
from( from(
select mv.member_id select 1
from member_video mv from member_video mv
left join face f on f.id = mv.face_id left join face f on f.id = mv.face_id
where f.scenic_id = #{scenicId} where f.scenic_id = #{scenicId}
and f.member_id in (select member_id from statistics where type = 10
<if test="startTime!= null"> <if test="startTime!= null">
and create_time >= #{startTime} and mv.create_time >= #{startTime}
</if> </if>
<if test="endTime!= null"> <if test="endTime!= null">
and create_time &lt;= #{endTime} and mv.create_time &lt;= #{endTime}
</if>) </if>
group by mv.member_id group by mv.member_id
)a )a
</select> </select>
@ -195,17 +181,19 @@
SELECT SELECT
IFNULL(count(1), 0) AS count IFNULL(count(1), 0) AS count
FROM ( FROM (
select count(1) as count select 1
from statistics FROM `t_stats_record` r
where type in (10) and scenic_id = #{scenicId} 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"
<if test="startTime!= null"> <if test="startTime!= null">
and create_time >= #{startTime} and s.create_time >= #{startTime}
</if> </if>
<if test="endTime!= null"> <if test="endTime!= null">
and create_time &lt;= #{endTime} and s.create_time &lt;= #{endTime}
</if> </if>
group by member_id group by s.member_id
) AS a; ) AS subquery;
</select> </select>
<select id="countCompleteOfVideo" resultType="java.lang.Integer"> <select id="countCompleteOfVideo" resultType="java.lang.Integer">
select count(1) as count select count(1) as count
@ -223,15 +211,17 @@
IFNULL(SUM(count), 0) AS count IFNULL(SUM(count), 0) AS count
FROM ( FROM (
select count(1) as count select count(1) as count
from statistics FROM `t_stats_record` r
where type=0 and scenic_id = #{scenicId} left join `t_stats` s on r.trace_id=s.trace_id
<if test="startTime!= null"> where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId})
and create_time >= #{startTime} and action = "LOAD" and identifier = "pages/videoSynthesis/buy"
</if> <if test="startTime!= null">
<if test="endTime!= null"> and s.create_time >= #{startTime}
and create_time &lt;= #{endTime} </if>
</if> <if test="endTime!= null">
group by morph_id and s.create_time &lt;= #{endTime}
</if>
group by JSON_EXTRACT(`params`, "$.id")
)a )a
</select> </select>
<select id="countPayOfOrder" resultType="java.lang.Integer"> <select id="countPayOfOrder" resultType="java.lang.Integer">
@ -271,29 +261,32 @@
</if> </if>
</select> </select>
<select id="getBrokerIdListForUser" resultType="java.lang.Long"> <select id="getBrokerIdListForUser" resultType="java.lang.Long">
select morph_id select identifier
from ( from (
select morph_id, max(create_time) as createTime select identifier, max(r.create_time) as createTime
from statistics FROM `t_stats_record` r
where type = 20 and member_id = #{memberId} left join `t_stats` s on r.trace_id=s.trace_id
where action = "CODE_SCAN"
and s.member_id = #{memberId}
<if test="startTime!= null"> <if test="startTime!= null">
and create_time >= #{startTime} and r.create_time >= #{startTime}
</if> </if>
<if test="endTime!= null"> <if test="endTime!= null">
and create_time &lt;= #{endTime} and r.create_time &lt;= #{endTime}
</if> </if>
group by morph_id group by identifier
) a ) a
order by createTime desc order by createTime desc
</select> </select>
<select id="getUserRecentEnterType" resultType="java.lang.Long"> <select id="getUserRecentEnterType" resultType="java.lang.Long">
select morph_id select JSON_EXTRACT(`params`, '$.scene')
from statistics FROM `t_stats_record` r
where type = 10 and member_id = #{memberId} left join `t_stats` s on r.trace_id=s.trace_id
where action = "LAUNCH" and s.member_id = #{memberId}
<if test="endTime!= null"> <if test="endTime!= null">
and create_time &lt;= #{endTime} and r.create_time &lt;= #{endTime}
</if> </if>
order by create_time desc order by r.create_time desc
limit 1 limit 1
</select> </select>
</mapper> </mapper>