fix(repository): 替换json数组解析函数为jsonb版本

将json_array_elements_text更换为jsonb_array_elements_text,适配数据库jsonb类型字段的解析操作,修复分类统计时的类型不匹配问题
This commit is contained in:
Kris 2026-07-09 04:23:56 +08:00
parent 33acf3b61e
commit d2d84cb27b

View File

@ -261,7 +261,7 @@ class ChannelContentReviewRecordRepository(BaseRepository):
block_rate = (block_count / total_reviews * 100) if total_reviews > 0 else 0.0 block_rate = (block_count / total_reviews * 100) if total_reviews > 0 else 0.0
# 按分类切片:展开 categories JSON 数组后分组计数 # 按分类切片:展开 categories JSON 数组后分组计数
category_expr = func.json_array_elements_text(ChannelContentReviewRecord.categories).label("category") category_expr = func.jsonb_array_elements_text(ChannelContentReviewRecord.categories).label("category")
category_stmt = ( category_stmt = (
select( select(
category_expr, category_expr,
@ -405,7 +405,7 @@ class ChannelContentReviewRecordRepository(BaseRepository):
manual_intervention_rate = (manual_count / total_reviews * 100) if total_reviews > 0 else 0.0 manual_intervention_rate = (manual_count / total_reviews * 100) if total_reviews > 0 else 0.0
# 按分类切片:展开 categories JSON 数组后分组计数 # 按分类切片:展开 categories JSON 数组后分组计数
category_expr = func.json_array_elements_text(ChannelContentReviewRecord.categories).label("category") category_expr = func.jsonb_array_elements_text(ChannelContentReviewRecord.categories).label("category")
category_stmt = ( category_stmt = (
select( select(
category_expr, category_expr,