This commit is contained in:
苏尹岚
2021-01-07 18:09:33 +08:00
parent bf5d742af0
commit 03d53ddc49

View File

@@ -472,12 +472,12 @@ func GetManageStatisticsJob(db *DaoDB, cityCodes []int, fromTime, toTime time.Ti
sql := `
SELECT t1.count acceptCount, t2.count finish_count, t3.count cancel_count, a.browse_count, a.title, a.browse_count / t2.count inversion_rate, t4.total_cash
FROM job a
JOIN (SELECT job_id, COUNT(*) count FROM job_order WHERE status = ? GROUP BY 1) t1 ON t1.job_id = a.id
JOIN (SELECT job_id, COUNT(*) count FROM job_order WHERE status = ? GROUP BY 1) t2 ON t2.job_id = a.id
JOIN (SELECT job_id, COUNT(*) count FROM job_order WHERE status = ? GROUP BY 1) t3 ON t3.job_id = a.id
LEFT JOIN (SELECT job_id, COUNT(*) count FROM job_order WHERE status = ? GROUP BY 1) t1 ON t1.job_id = a.id
LEFT JOIN (SELECT job_id, COUNT(*) count FROM job_order WHERE status = ? GROUP BY 1) t2 ON t2.job_id = a.id
LEFT JOIN (SELECT job_id, COUNT(*) count FROM job_order WHERE status = ? GROUP BY 1) t3 ON t3.job_id = a.id
`
sql += `
JOIN (SELECT COUNT(b.id) * a.avg_price total_cash, a.id
LEFT JOIN (SELECT COUNT(b.id) * a.avg_price total_cash, a.id
FROM job a
JOIN job_order b ON a.id = b.job_id AND b.status = ?
GROUP BY 2) t4 ON t4.id = a.id