This commit is contained in:
aaron 2025-02-18 13:21:00 +08:00
parent a01fd23708
commit db6a9af7c0

View File

@ -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
},