diff --git a/app/api/endpoints/order.py b/app/api/endpoints/order.py index 074f1dd..a16b61e 100644 --- a/app/api/endpoints/order.py +++ b/app/api/endpoints/order.py @@ -374,6 +374,7 @@ async def get_order_status_count( @router.get("/community_building/count", response_model=ResponseModel) async def get_community_building_order_count( community_id: int, + status: str, db: Session = Depends(get_db), current_user: UserDB = Depends(get_current_user) ): @@ -387,6 +388,7 @@ async def get_community_building_order_count( if not community_buildings: return error_response(code=404, message="社区不存在") + # 查询每个楼栋的订单数量 building_order_count = db.query( @@ -396,10 +398,12 @@ async def get_community_building_order_count( ShippingOrderDB.address_community_building_id.in_( [building.id for building in community_buildings] ) + ).filter( + ShippingOrderDB.status.in_(status.split(",")) ).group_by( ShippingOrderDB.address_community_building_id ).all() - + # 没有订单的楼栋,订单数量为0 result = [] @@ -484,6 +488,7 @@ async def get_user_orders( "address": { "name": order.address_customer_name, "phone": order.address_customer_phone, + "gender": order.address_customer_gender, "community_id": order.address_community_id, "community_name": order.address_community_name, "building_id": order.address_community_building_id, @@ -626,7 +631,10 @@ async def get_deliveryman_orders( "address": { "name": order.address_customer_name, "phone": order.address_customer_phone, + "gender": order.address_customer_gender, + "community_id": order.address_community_id, "community_name": order.address_community_name, + "building_id": order.address_community_building_id, "building_name": order.address_community_building_name, "address_detail": order.address_detail },