feat(订单服务): 在订单统计查询中添加sku字段
在订单商品统计查询SQL中增加sku字段,以便按商品SKU进行分组统计和展示
This commit is contained in:
parent
efbd318917
commit
a556ab69bf
|
|
@ -1479,7 +1479,7 @@ export class OrderService {
|
|||
}
|
||||
|
||||
let itemSql = `
|
||||
SELECT os.productId, os.name, SUM(os.quantity) AS totalQuantity, COUNT(DISTINCT os.orderId) AS totalOrders
|
||||
SELECT os.productId, os.name, os.sku, SUM(os.quantity) AS totalQuantity, COUNT(DISTINCT os.orderId) AS totalOrders
|
||||
FROM order_sale os
|
||||
INNER JOIN \`order\` o ON o.id = os.orderId
|
||||
WHERE o.date_paid BETWEEN ? AND ?
|
||||
|
|
@ -1501,7 +1501,7 @@ export class OrderService {
|
|||
}
|
||||
itemSql += nameCondition;
|
||||
itemSql += `
|
||||
GROUP BY os.productId, os.name
|
||||
GROUP BY os.productId, os.name, os.sku
|
||||
ORDER BY totalQuantity DESC
|
||||
LIMIT ? OFFSET ?
|
||||
`;
|
||||
|
|
|
|||
Loading…
Reference in New Issue