fix: 产品查询去掉org_id限制,使用跨库JOIN

This commit is contained in:
Hermes Agent 2026-06-24 21:26:55 +08:00
parent 9997c8a087
commit 01a4dddc59

View File

@ -25,16 +25,14 @@ SELECT
dd.id as detail_id,
dd.discount,
dd.discountid
FROM product p
LEFT JOIN product_category pc ON p.category_id = pc.id
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.org_id = ${org_id}$ AND p.status = '1'
WHERE p.status = '1'
ORDER BY pc.name, p.product_name
'''
ns['org_id'] = user_orgid
db = DBPools()
dbname = get_module_dbname('discount')
async with db.sqlorContext(dbname) as sor: