This commit is contained in:
aaron 2025-03-24 14:21:57 +08:00
parent 6d16699c02
commit 3ad1286379
2 changed files with 4 additions and 0 deletions

View File

@ -76,6 +76,7 @@ async def update_product(
@router.get("/list", response_model=ResponseModel)
async def list_merchant_products(
merchant_id: Optional[int] = None,
community_id: Optional[int] = None,
skip: int = 0,
limit: int = 20,
db: Session = Depends(get_db)
@ -89,6 +90,9 @@ async def list_merchant_products(
# 如果指定了商家ID添加筛选条件
if merchant_id:
query = query.filter(MerchantProductDB.merchant_id == merchant_id)
if community_id:
query = query.filter(MerchantProductDB.merchant.has(community_id=community_id))
total = query.count()
results = query.order_by(

Binary file not shown.