From c8827012b02179645a4cde3090dfe33533969a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 6 Jan 2021 15:58:06 +0800 Subject: [PATCH] aa --- business/jxstore/report/report.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index 0a97d46e3..044eb1a96 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -304,11 +304,12 @@ func getStoreStatusCount(db *dao.DaoDB, cityCodes []int, vendorID, status int) ( countType := &struct{ Count int }{} sqlParams := []interface{}{} sql := ` - SELECT COUNT(a.id) count + SELECT COUNT(DISTINCT a.id) count FROM store a LEFT JOIN store_map b ON a.id = b.store_id AND b.deleted_at = ? + WHERE a.deleted_at = ? ` - sqlParams = append(sqlParams, utils.DefaultTimeValue) + sqlParams = append(sqlParams, utils.DefaultTimeValue, utils.DefaultTimeValue) if len(cityCodes) > 0 { sql += " AND a.city_code IN (" + dao.GenQuestionMarks(len(cityCodes)) + ")" sqlParams = append(sqlParams, cityCodes) @@ -320,13 +321,8 @@ func getStoreStatusCount(db *dao.DaoDB, cityCodes []int, vendorID, status int) ( sql += " AND a.status = ?" sqlParams = append(sqlParams, status) } - sql += ` - WHERE a.deleted_at = ? - ` - sqlParams = append(sqlParams, utils.DefaultTimeValue) fmt.Println(sql) fmt.Println(sqlParams) - sqlParams = append(sqlParams, utils.DefaultTimeValue, utils.DefaultTimeValue) err = dao.GetRow(db, &countType, sql, sqlParams) return countType.Count, err }