add GaoProductStockBatchRequest

This commit is contained in:
Timi
2026-09-16 15:15:19 +08:00
parent cd8bcae5be
commit 7d53d31c3f
9 changed files with 117 additions and 4 deletions
@@ -10,6 +10,25 @@
SELECT * FROM `gao_product_stock`
WHERE `store_id` = #{storeId} AND `sku_id` = #{skuId}
</select>
<select id="selectByStoreIdAndSkuIdList" resultType="com.imyeyu.api.modules.gao.entity.GaoProductStock">
SELECT s.`id`,
k.`store_id`,
k.`id` AS `sku_id`,
COALESCE(s.`on_hand_quantity`, 0) AS `on_hand_quantity`,
COALESCE(s.`reserved_quantity`, 0) AS `reserved_quantity`,
s.`updated_by`,
s.`created_at`,
s.`updated_at`
FROM `gao_product_sku` k
JOIN `gao_product` p ON p.`id` = k.`product_id`
LEFT JOIN `gao_product_stock` s ON s.`sku_id` = k.`id` AND s.`store_id` = #{storeId}
WHERE k.`store_id` = #{storeId}
AND p.`deleted_at` IS NULL AND k.`deleted_at` IS NULL
AND k.`id` IN
<foreach collection="skuIdList" item="skuId" open="(" separator="," close=")">
#{skuId}
</foreach>
</select>
<select id="countByQuery" resultType="long">
SELECT COUNT(1)
FROM `gao_product_sku` k