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) @router.get("/community_building/count", response_model=ResponseModel)
async def get_community_building_order_count( async def get_community_building_order_count(
community_id: int, community_id: int,
status: str,
db: Session = Depends(get_db), db: Session = Depends(get_db),
current_user: UserDB = Depends(get_current_user) current_user: UserDB = Depends(get_current_user)
): ):
@ -388,6 +389,7 @@ async def get_community_building_order_count(
if not community_buildings: if not community_buildings:
return error_response(code=404, message="社区不存在") return error_response(code=404, message="社区不存在")
# 查询每个楼栋的订单数量 # 查询每个楼栋的订单数量
building_order_count = db.query( building_order_count = db.query(
ShippingOrderDB.address_community_building_id, ShippingOrderDB.address_community_building_id,
@ -396,6 +398,8 @@ async def get_community_building_order_count(
ShippingOrderDB.address_community_building_id.in_( ShippingOrderDB.address_community_building_id.in_(
[building.id for building in community_buildings] [building.id for building in community_buildings]
) )
).filter(
ShippingOrderDB.status.in_(status.split(","))
).group_by( ).group_by(
ShippingOrderDB.address_community_building_id ShippingOrderDB.address_community_building_id
).all() ).all()
@ -484,6 +488,7 @@ async def get_user_orders(
"address": { "address": {
"name": order.address_customer_name, "name": order.address_customer_name,
"phone": order.address_customer_phone, "phone": order.address_customer_phone,
"gender": order.address_customer_gender,
"community_id": order.address_community_id, "community_id": order.address_community_id,
"community_name": order.address_community_name, "community_name": order.address_community_name,
"building_id": order.address_community_building_id, "building_id": order.address_community_building_id,
@ -626,7 +631,10 @@ async def get_deliveryman_orders(
"address": { "address": {
"name": order.address_customer_name, "name": order.address_customer_name,
"phone": order.address_customer_phone, "phone": order.address_customer_phone,
"gender": order.address_customer_gender,
"community_id": order.address_community_id,
"community_name": order.address_community_name, "community_name": order.address_community_name,
"building_id": order.address_community_building_id,
"building_name": order.address_community_building_name, "building_name": order.address_community_building_name,
"address_detail": order.address_detail "address_detail": order.address_detail
}, },