|
|
@@ -70,8 +70,7 @@
|
|
|
<!-- 指定律所ID时,从律所表开始,确保即使没有订单也返回 -->
|
|
|
SELECT
|
|
|
COUNT(DISTINCT lco.id) as order_count,
|
|
|
- COALESCE(SUM(lco.lawyer_earnings), 0) as total_amount,
|
|
|
- COALESCE(SUM(lco.consultation_fee), 0) as total_platform_service_fee
|
|
|
+ COALESCE(SUM(lco.order_amount), 0) as total_amount
|
|
|
FROM law_firm lf
|
|
|
LEFT JOIN lawyer_consultation_order lco ON lco.place_id = lf.id
|
|
|
AND lco.delete_flag = 0
|
|
|
@@ -89,8 +88,7 @@
|
|
|
<!-- 未指定律所ID时,从订单表开始 -->
|
|
|
SELECT
|
|
|
COUNT(DISTINCT lco.id) as order_count,
|
|
|
- COALESCE(SUM(lco.lawyer_earnings), 0) as total_amount,
|
|
|
- COALESCE(SUM(lco.consultation_fee), 0) as total_platform_service_fee
|
|
|
+ COALESCE(SUM(lco.order_amount), 0) as total_amount
|
|
|
FROM lawyer_consultation_order lco
|
|
|
LEFT JOIN law_firm lf ON lco.place_id = lf.id
|
|
|
AND lf.delete_flag = 0
|
|
|
@@ -191,8 +189,7 @@
|
|
|
lf.id as firm_id,
|
|
|
lf.firm_name,
|
|
|
COUNT(DISTINCT lco.id) as order_count,
|
|
|
- CAST(ROUND(COALESCE(SUM(lco.lawyer_earnings), 0) / 100.0, 2) AS CHAR) as total_amount_yuan,
|
|
|
- CAST(ROUND(COALESCE(SUM(lco.consultation_fee), 0) / 100.0, 2) AS CHAR) as commission_fee_yuan
|
|
|
+ CAST(ROUND(COALESCE(SUM(lco.order_amount), 0) / 100.0, 2) AS CHAR) as total_amount_yuan
|
|
|
FROM lawyer_user lu
|
|
|
INNER JOIN law_firm lf ON lu.firm_id = lf.id
|
|
|
AND lf.delete_flag = 0
|