This commit is contained in:
suyl
2021-05-22 15:59:52 +08:00
parent 2d45a39017
commit ff62d8c472

View File

@@ -709,9 +709,9 @@ func UserMemberReport(ctx *jxcontext.Context, vendorID int, keyword string, offs
)
var list []*dao.UserMemberReportResult
sql := `
SELECT a.mobile, IF(a.vendor_id = ?, b.name, t1.consignee_name) name, IF(a.deleted_at = ?, ?, ?) status, a.vendor_id, t1.buy_count, t1.buy_price,
t1.good_comment_count, t1.bad_comment_count, t2.finished_count, t2.finished_price
FROM user_member a
SELECT SQL_CALC_FOUND_ROWS a.mobile, IF(a.vendor_id = ?, b.name, t1.consignee_name) name, IF(a.deleted_at = ?, ?, ?) status, a.vendor_id, t1.buy_count, t1.buy_price,
t1.good_comment_count, t1.bad_comment_count, t2.finished_count, t2.finished_price
FROM user_member a
LEFT JOIN user b ON a.mobile = b.mobile
LEFT JOIN (
SELECT a.mobile, MAX(b.consignee_name) consignee_name, COUNT(b.vendor_store_id) buy_count, SUM(ISNULL(b.actual_pay_price)) buy_price, COUNT(c.score > 3) good_comment_count, COUNT(c.score < 3) bad_comment_count
@@ -726,6 +726,7 @@ func UserMemberReport(ctx *jxcontext.Context, vendorID int, keyword string, offs
LEFT JOIN goods_order b ON a.mobile = b.consignee_mobile2 AND a.vendor_id = b.vendor_id AND b.order_type = ? AND status = ? AND b.store_id <> ?
GROUP BY 1
)t2 ON t2.mobile = a.mobile
WHERE 1 = 1
`
sqlParams := []interface{}{
model.VendorIDJX, utils.DefaultTimeValue, model.YES, model.NO,