统计调整

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