fix: remove ns['sort'] to avoid sqlPaging outer ORDER BY conflict
This commit is contained in:
parent
9c7a39e519
commit
9645d397b6
@ -13,8 +13,6 @@ if not user_orgid:
|
||||
ns = params_kw.copy()
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
ns['sort'] = 'pc_name, product_name'
|
||||
|
||||
ns['org_id'] = user_orgid
|
||||
|
||||
@ -30,9 +28,8 @@ async with db.sqlorContext(dbname) as sor:
|
||||
sql = '''
|
||||
SELECT
|
||||
p.id as productid,
|
||||
pc.name as pc_name,
|
||||
p.product_name,
|
||||
p.product_code,
|
||||
p.product_name,
|
||||
p.category_id,
|
||||
pc.name as category_name,
|
||||
dd.id as detail_id,
|
||||
@ -46,10 +43,11 @@ LEFT JOIN discount_detail dd ON dd.productid = p.id
|
||||
LEFT JOIN discount_detail base_dd ON base_dd.productid = p.id
|
||||
AND base_dd.discountid = ${base_discountid}$
|
||||
WHERE p.org_id = ${org_id}$ AND p.status = '1'
|
||||
ORDER BY pc.name, p.product_name
|
||||
'''
|
||||
|
||||
debug(f'get_products_with_discount: org_id={user_orgid}, discountid={discountid}, dbname={dbname}, base_discountid={ns["base_discountid"]}')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.sqlPaging(sql, ns.copy())
|
||||
debug(f'{sql=}, {ns=},get_products_with_discount: returned {len(r.get("rows", []))} products')
|
||||
debug(f'{ns=},get_products_with_discount: returned {len(r.get("rows", []))} products')
|
||||
return r
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user