|
|
@@ -29,6 +29,7 @@
|
|
|
FROM aitag_tag_log
|
|
|
WHERE
|
|
|
tag_scope = 0
|
|
|
+ AND is_delete = 0
|
|
|
<if test="startTaggingTime != null and startTaggingTime != ''">
|
|
|
AND insert_time >= #{startTaggingTime}
|
|
|
</if>
|
|
|
@@ -47,6 +48,7 @@
|
|
|
FROM aitag_tag_log
|
|
|
WHERE
|
|
|
tag_scope = 0
|
|
|
+ AND is_delete = 0
|
|
|
<if test="startTaggingTime != null and startTaggingTime != ''">
|
|
|
AND insert_time >= #{startTaggingTime}
|
|
|
</if>
|
|
|
@@ -67,6 +69,7 @@
|
|
|
FROM aitag_tag_log
|
|
|
WHERE
|
|
|
tag_scope = 0
|
|
|
+ AND is_delete = 0
|
|
|
<if test="startTaggingTime != null and startTaggingTime != ''">
|
|
|
AND insert_time >= #{startTaggingTime}
|
|
|
</if>
|
|
|
@@ -87,6 +90,7 @@
|
|
|
FROM aitag_tag_log
|
|
|
WHERE
|
|
|
tag_scope = 0
|
|
|
+ AND is_delete = 0
|
|
|
<if test="startTaggingTime != null and startTaggingTime != ''">
|
|
|
AND insert_time >= #{startTaggingTime}
|
|
|
</if>
|
|
|
@@ -105,6 +109,7 @@
|
|
|
FROM aitag_tag_log
|
|
|
WHERE
|
|
|
tag_scope = 0
|
|
|
+ AND is_delete = 0
|
|
|
AND DATE(insert_time) = #{insertTime}
|
|
|
AND state in ('2','3')
|
|
|
</select>
|
|
|
@@ -112,31 +117,52 @@
|
|
|
|
|
|
<select id="selectTagDistStats" resultType="cn.com.yusys.yusp.domain.vo.IconResVo" parameterType="cn.com.yusys.yusp.domain.vo.TagDistStatsReqVo">
|
|
|
SELECT
|
|
|
- elem->>'tag_name' AS stat,
|
|
|
+ tag_name AS stat,
|
|
|
COUNT(1) AS val
|
|
|
- FROM
|
|
|
- aitag_tag_log t,
|
|
|
- jsonb_array_elements(result) AS elem
|
|
|
- WHERE
|
|
|
- t.tag_scope = 0
|
|
|
+ FROM (
|
|
|
+ -- 从feedback_result获取
|
|
|
+ SELECT elem->>'tag_name' AS tag_name
|
|
|
+ FROM ai_tagging.aitag_tag_log t
|
|
|
+ CROSS JOIN LATERAL jsonb_array_elements(t.feedback_result) elem
|
|
|
+ WHERE t.is_delete = 0
|
|
|
+ AND t.tag_scope = 0
|
|
|
AND t.state in ('2','3')
|
|
|
+ AND t.feedback_result IS NOT NULL
|
|
|
+ AND jsonb_array_length(t.feedback_result) > 0
|
|
|
+ AND elem->>'passr' = 'true'
|
|
|
+ <if test="categoryId != null and categoryId != '' ">
|
|
|
+ AND elem->>'category_id' = #{categoryId}
|
|
|
+ </if>
|
|
|
<if test="startTaggingTime != null and startTaggingTime != ''">
|
|
|
AND insert_time >= #{startTaggingTime}
|
|
|
</if>
|
|
|
<if test="endTaggingTime != null and endTaggingTime != ''">
|
|
|
AND #{endTaggingTime} >= insert_time
|
|
|
</if>
|
|
|
+ UNION ALL
|
|
|
+ SELECT elem->>'tag_name' AS tag_name
|
|
|
+ FROM ai_tagging.aitag_tag_log t
|
|
|
+ CROSS JOIN LATERAL jsonb_array_elements(t.result) elem
|
|
|
+ WHERE t.is_delete = 0
|
|
|
+ AND t.tag_scope = 0
|
|
|
+ AND t.state in ('2','3')
|
|
|
+ AND t.feedback_result IS NULL
|
|
|
+ AND t.result IS NOT null
|
|
|
+ AND jsonb_array_length(t.result) > 0
|
|
|
+ AND elem->>'passr' = 'true'
|
|
|
<if test="categoryId != null and categoryId != '' ">
|
|
|
- AND elem.value->>'category_id' = #{categoryId}
|
|
|
+ AND elem->>'category_id' = #{categoryId}
|
|
|
</if>
|
|
|
- GROUP BY
|
|
|
- elem->>'tag_name'
|
|
|
- <if test="sort == 'ase'">
|
|
|
- order by val
|
|
|
+ <if test="startTaggingTime != null and startTaggingTime != ''">
|
|
|
+ AND insert_time >= #{startTaggingTime}
|
|
|
</if>
|
|
|
- <if test="sort == 'desc' ">
|
|
|
- order by val desc
|
|
|
+ <if test="endTaggingTime != null and endTaggingTime != ''">
|
|
|
+ AND #{endTaggingTime} >= insert_time
|
|
|
</if>
|
|
|
+ ) valid_tags
|
|
|
+ WHERE tag_name IS NOT NULL
|
|
|
+ GROUP BY tag_name
|
|
|
+ ORDER BY val desc
|
|
|
Limit 6
|
|
|
</select>
|
|
|
|