chore: 删除残留的api文件
This commit is contained in:
parent
29578196a1
commit
84eaf6c1ee
@ -1,44 +0,0 @@
|
|||||||
# 获取用户机构的所有产品及其折扣信息
|
|
||||||
# 用于折扣明细设置页面
|
|
||||||
|
|
||||||
ns = params_kw.copy()
|
|
||||||
discountid = ns.get('discountid')
|
|
||||||
|
|
||||||
if not discountid:
|
|
||||||
return {"total": 0, "rows": []}
|
|
||||||
|
|
||||||
user_orgid = await get_userorgid()
|
|
||||||
if not user_orgid:
|
|
||||||
return {"total": 0, "rows": []}
|
|
||||||
|
|
||||||
if not ns.get('page'):
|
|
||||||
ns['page'] = 1
|
|
||||||
if not ns.get('sort'):
|
|
||||||
ns['sort'] = 'category_id, product_name'
|
|
||||||
|
|
||||||
# 查询用户机构的所有产品,LEFT JOIN折扣明细
|
|
||||||
sql = '''
|
|
||||||
SELECT
|
|
||||||
p.id as productid,
|
|
||||||
p.product_name,
|
|
||||||
p.product_code,
|
|
||||||
p.category_id,
|
|
||||||
pc.name as category_name,
|
|
||||||
COALESCE(dd.id, '') as detail_id,
|
|
||||||
COALESCE(dd.discount, 0) as discount
|
|
||||||
FROM product p
|
|
||||||
LEFT JOIN 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'
|
|
||||||
ORDER BY p.category_id, p.product_name
|
|
||||||
'''
|
|
||||||
|
|
||||||
ns['org_id'] = user_orgid
|
|
||||||
ns['discountid'] = discountid
|
|
||||||
|
|
||||||
db = DBPools()
|
|
||||||
dbname = get_module_dbname('discount')
|
|
||||||
async with db.sqlorContext(dbname) as sor:
|
|
||||||
r = await sor.sqlPaging(sql, ns)
|
|
||||||
debug(f'get_product_discount_list: {len(r.get("rows", []))} products')
|
|
||||||
return r
|
|
||||||
Loading…
x
Reference in New Issue
Block a user