diff --git a/wwwroot/discount_setting/get_products_with_discount.dspy b/wwwroot/discount_setting/get_products_with_discount.dspy index 1fd4664..1062106 100644 --- a/wwwroot/discount_setting/get_products_with_discount.dspy +++ b/wwwroot/discount_setting/get_products_with_discount.dspy @@ -29,13 +29,16 @@ FROM {product_management}.product p LEFT JOIN {product_management}.product_category pc ON p.category_id = pc.id LEFT JOIN discount_detail dd ON dd.productid = p.id AND dd.discountid = ${discountid}$ -WHERE p.status = '1' +WHERE p.org_id = ${org_id}$ AND p.status = '1' ORDER BY pc.name, p.product_name ''' +ns['org_id'] = user_orgid + db = DBPools() dbname = get_module_dbname('discount') +debug(f'get_products_with_discount: org_id={user_orgid}, discountid={discountid}, dbname={dbname}') async with db.sqlorContext(dbname) as sor: r = await sor.sqlPaging(sql, ns) - debug(f'get_products_with_discount: {len(r.get("rows", []))} products for org {user_orgid}') + debug(f'get_products_with_discount: returned {len(r.get("rows", []))} products') return r