fix: ORDER BY改用$参数化

This commit is contained in:
yumoqing 2026-06-29 15:56:09 +08:00
parent dafa2d5eb2
commit 52d48c964a

View File

@ -765,9 +765,10 @@ async def get_discount_setting_products(request):
LEFT JOIN discount_detail dd ON dd.productid = p.id LEFT JOIN discount_detail dd ON dd.productid = p.id
AND dd.discountid = ${discountid}$ AND dd.discountid = ${discountid}$
WHERE p.org_id = ${org_id}$ AND p.status = '1' WHERE p.org_id = ${org_id}$ AND p.status = '1'
ORDER BY pc.name, p.product_name ORDER BY ${sort}$
""" """
ns = {'discountid': discountid, 'org_id': user_orgid, 'sort': 'pc.name, p.product_name'}
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
recs = await sor.sqlExe(sql, {'discountid': discountid, 'org_id': user_orgid}) recs = await sor.sqlExe(sql, ns)
return recs if recs else [] return recs if recs else []