This commit is contained in:
suyl
2021-05-21 15:47:39 +08:00
parent 0fd76bd77f
commit cb6a2ef8f7

View File

@@ -709,9 +709,9 @@ func UserMemberReport(ctx *jxcontext.Context, vendorID int, keyword string, offs
)
var list []*dao.UserMemberReportResult
sql := `
SELECT SQL_CALC_FOUND_ROWS a.mobile, IF(a.vendor_id = ?, c.name, b.consignee_name) name, IF(a.deleted_at = '1970-01-01 00:00:00',0,1) status, a.vendor_id,
COUNT(b.*) buy_count, COUNT(bb.*) finished_count, SUM(b.actual_pay_price) buy_price, SUM(b.actual_pay_price) finished_price, COUNT(d.score > 3) good_comment_count,
COUNT(d.score < 3) bad_comment_count
SELECT SQL_CALC_FOUND_ROWS a.mobile, IF(a.vendor_id = ?, c.name, b.consignee_name) name, IF(a.deleted_at = '1970-01-01 00:00:00',1,0) status, a.vendor_id,
COUNT(DISTINCT b.vendor_store_id) buy_count, COUNT(DISTINCT bb.vendor_store_id) finished_count, SUM(DISTINCT b.actual_pay_price) buy_price,
SUM(DISTINCT b.actual_pay_price) finished_price, COUNT(d.score > 3) good_comment_count, COUNT(d.score < 3) bad_comment_count
FROM user_member a
LEFT JOIN goods_order b ON a.mobile = b.consignee_mobile2 AND a.vendor_id = b.vendor_id
LEFT JOIN goods_order bb ON a.mobile = bb.consignee_mobile2 AND bb.status = ? AND a.vendor_id = bb.vendor_id