diff --git a/business/model/dao/report.go b/business/model/dao/report.go index 806fd3b1c..98dc53397 100644 --- a/business/model/dao/report.go +++ b/business/model/dao/report.go @@ -131,26 +131,27 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs, vendorIDs []int, fromDate GROUP BY 1 )ss ) s ON s.store_id = c.id + WHERE 1 = 1 ` if len(storeIDs) > 0 { - sql += ` WHERE c.id IN (` + GenQuestionMarks(len(storeIDs)) + `)` + sql += ` AND c.id IN (` + GenQuestionMarks(len(storeIDs)) + `)` sqlParams = append(sqlParams, storeIDs) } if marketPhone != "" { - sql += ` WHERE c.market_man_phone = ?` + sql += ` AND c.market_man_phone = ?` sqlParams = append(sqlParams, marketPhone) } if jdPhone != "" { - sql += ` WHERE c.operator_phone = ?` - sqlParams = append(sqlParams, marketPhone) + sql += ` AND c.operator_phone = ?` + sqlParams = append(sqlParams, jdPhone) } if mtPhone != "" { - sql += ` WHERE c.operator_phone2 = ?` - sqlParams = append(sqlParams, marketPhone) + sql += ` AND c.operator_phone2 = ?` + sqlParams = append(sqlParams, mtPhone) } if ebaiPhone != "" { - sql += ` WHERE c.operator_phone3 = ?` - sqlParams = append(sqlParams, marketPhone) + sql += ` AND c.operator_phone3 = ?` + sqlParams = append(sqlParams, ebaiPhone) } if err = GetRows(db, &statisticsReportForOrdersList, sql, sqlParams...); err == nil { return statisticsReportForOrdersList, nil