Compare commits

...

2 Commits

2 changed files with 10 additions and 2 deletions

View File

@@ -127,5 +127,11 @@ public class HotHiddenDangerPlanVo implements Serializable {
@ExcelProperty(value = "未完成数")
private Long pendingCount;
/**
* 待审核人数
*/
@ExcelProperty(value = "待审核人数")
private Long pendingAuditCount;
}

View File

@@ -21,13 +21,15 @@
p.is_auto_generated_by_backend,
p.plan_date_key,
COALESCE(stats.completed_count, 0) AS completedCount,
COALESCE(stats.pending_count, 0) AS pendingCount
COALESCE(stats.pending_count, 0) AS pendingCount,
COALESCE(stats.pending_audit_count, 0) AS pendingAuditCount
FROM hot_hidden_danger_plan p
LEFT JOIN (
SELECT
i.plan_id,
SUM(CASE WHEN i.status IN (3, 9) THEN 1 ELSE 0 END) AS completed_count,
SUM(CASE WHEN i.status IS NULL OR i.status NOT IN (3, 9) THEN 1 ELSE 0 END) AS pending_count
SUM(CASE WHEN i.status IS NULL OR i.status NOT IN (3, 9) THEN 1 ELSE 0 END) AS pending_count,
SUM(CASE WHEN i.status IN (2, 5) THEN 1 ELSE 0 END) AS pending_audit_count
FROM hot_hidden_danger_inspection i
WHERE i.is_deleted = 0
GROUP BY i.plan_id