diff --git a/business/q_bida/q_bida_server.go b/business/q_bida/q_bida_server.go index 847dea853..8f65e69e5 100644 --- a/business/q_bida/q_bida_server.go +++ b/business/q_bida/q_bida_server.go @@ -225,21 +225,24 @@ func QueryOrderDetail(typeCode int, orderNo string) (*bida.OrderDetail, error) { } // QueryUserOrderList 查询用户订单列表 -func QueryUserOrderList(userId string, expressType, orderStatus int, pageNum, pageSize int) ([]*model.UserOrderList, error) { +func QueryUserOrderList(userId string, expressType, orderStatus int, pageNum, pageSize int, orderNo string) ([]*model.UserOrderList, error) { sql := ` - SELECT  - a.type,a.other_way_bill,a.local_way_bill,a.user_id,a.receive_address_id,a.sender_address_id, - a.create_at,a.order_status,a.channel_fee,add.consignee_name send_user_name,add2.consignee_name receive_user_name, - district.name sender_address,city.name receive_address + SELECT a.type,a.other_way_bill,a.local_way_bill,a.user_id,a.receive_address_id,a.sender_address_id, + a.created_at,a.order_status,a.channel_fee,add1.consignee_name send_user_name,add2.consignee_name receive_user_name, + district.name sender_address,city.name receive_address FROM user_vendor_order a - LEFT JOIN user_delivery_address add ON a.sender_address_id = add.id + LEFT JOIN user_delivery_address add1 ON a.sender_address_id = add1.id LEFT JOIN user_delivery_address add2 ON a.receive_address_id = add2.id - LEFT JOIN place district ON district.code = add.district_code - LEFT JOIN place city ON city.code = add2.district_code + LEFT JOIN place district ON district.code = add1.city_code + LEFT JOIN place city ON city.code = add2.city_code WHERE a.user_id = ? ` param := make([]interface{}, 0, 0) param = append(param, userId) + if orderNo != "" { + sql = sql + ` a.other_way_bill = ? OR a.local_way_bill = ? ` + param = append(param, orderNo, orderNo) + } if expressType != 0 { sql = sql + ` a.type = ? ` param = append(param, expressType) diff --git a/controllers/q_bida.go b/controllers/q_bida.go index ac7893ac6..16df0a012 100644 --- a/controllers/q_bida.go +++ b/controllers/q_bida.go @@ -164,6 +164,7 @@ func (c *QBiDaExpressController) CancelWayVendorOrder() { // @Param token header string true "管理员token" // @Param expressType formData int false "就是type快递公司" // @Param orderStatus formData int false "订单状态" +// @Param orderNo formData string false "订单号码" // @Param pageNum formData int true "页码" // @Param pageSize formData int true "页数" // @Success 200 {object} controllers.CallResult @@ -171,7 +172,7 @@ func (c *QBiDaExpressController) CancelWayVendorOrder() { // @router /QueryUserOrderList [post] func (c *QBiDaExpressController) QueryUserOrderList() { c.callQueryUserOrderList(func(params *tExpressQueryUserOrderListParams) (interface{}, string, error) { - result, err := bidaServer.QueryUserOrderList(params.Ctx.GetUserID(), params.ExpressType, params.OrderStatus, params.PageNum, params.PageSize) + result, err := bidaServer.QueryUserOrderList(params.Ctx.GetUserID(), params.ExpressType, params.OrderStatus, params.PageNum, params.PageSize, params.OrderNo) if err != nil { return nil, "", err }