- fix bug when get OrderManager.GetOrders when orderID given

This commit is contained in:
gazebo
2019-02-16 18:19:58 +08:00
parent c598f54e6a
commit 0f9949d73d

View File

@@ -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 + "%"