From 0f9949d73d5bf0979357acc7e9eaf5e8ec85d161 Mon Sep 17 00:00:00 2001 From: gazebo Date: Sat, 16 Feb 2019 18:19:58 +0800 Subject: [PATCH] - fix bug when get OrderManager.GetOrders when orderID given --- business/jxcallback/orderman/orderman_ext.go | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index af95e8dd4..2a102bfeb 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -258,17 +258,23 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, fromDateStr, toDateStr FROM goods_order t1 LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id ` - sqlWhere := ` - WHERE t1.order_created_at >= ? AND t1.order_created_at < ? - ` - sqlParams := []interface{}{ - fromDate, - toDate, - } + var ( + sqlWhere string + sqlParams []interface{} + ) if params["orderID"] != nil { - sqlWhere += " AND t1.vendor_order_id = ?" - sqlParams = append(sqlParams, params["orderID"].(string)) + sqlWhere = " WHERE t1.vendor_order_id = ?" + sqlParams = []interface{}{ + params["orderID"].(string), + } } else { + sqlWhere = ` + WHERE t1.order_created_at >= ? AND t1.order_created_at < ? + ` + sqlParams = []interface{}{ + fromDate, + toDate, + } if params["keyword"] != nil { keyword := params["keyword"].(string) keywordLike := "%" + keyword + "%"