with skuId for only once sku
This commit is contained in:
@@ -32,6 +32,9 @@ public class GaoProductStockProductView {
|
|||||||
/// 可库存 SKU 数量
|
/// 可库存 SKU 数量
|
||||||
private Long skuCount;
|
private Long skuCount;
|
||||||
|
|
||||||
|
/// 产品仅有一个可库存 SKU 时的 SKU ID
|
||||||
|
private String skuId;
|
||||||
|
|
||||||
/// 库存数量,使用基础单位
|
/// 库存数量,使用基础单位
|
||||||
private BigDecimal onHandQuantity;
|
private BigDecimal onHandQuantity;
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@
|
|||||||
p.`name` AS `product_name`,
|
p.`name` AS `product_name`,
|
||||||
p.`product_type`,
|
p.`product_type`,
|
||||||
COUNT(k.`id`) AS `sku_count`,
|
COUNT(k.`id`) AS `sku_count`,
|
||||||
|
CASE WHEN COUNT(k.`id`) = 1 THEN MAX(k.`id`) END AS `sku_id`,
|
||||||
COALESCE(SUM(COALESCE(s.`on_hand_quantity`, 0)), 0) AS `on_hand_quantity`,
|
COALESCE(SUM(COALESCE(s.`on_hand_quantity`, 0)), 0) AS `on_hand_quantity`,
|
||||||
COALESCE(SUM(COALESCE(s.`reserved_quantity`, 0)), 0) AS `reserved_quantity`,
|
COALESCE(SUM(COALESCE(s.`reserved_quantity`, 0)), 0) AS `reserved_quantity`,
|
||||||
COALESCE(SUM(COALESCE(s.`on_hand_quantity`, 0) - COALESCE(s.`reserved_quantity`, 0)), 0) AS `available_quantity`
|
COALESCE(SUM(COALESCE(s.`on_hand_quantity`, 0) - COALESCE(s.`reserved_quantity`, 0)), 0) AS `available_quantity`
|
||||||
|
|||||||
Reference in New Issue
Block a user