diff --git a/wwwroot/api/get_product_discount_list.dspy b/wwwroot/api/get_product_discount_list.dspy deleted file mode 100644 index 22f62da..0000000 --- a/wwwroot/api/get_product_discount_list.dspy +++ /dev/null @@ -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