|
@@ -221,19 +221,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
<select id="selectStockTenseCount" resultType="java.lang.Integer">
|
|
<select id="selectStockTenseCount" resultType="java.lang.Integer">
|
|
|
select count(1)
|
|
select count(1)
|
|
|
- from (select tpsss.stock
|
|
|
|
|
|
|
+ from (select IFNULL(sum(tpsss.stock),0) as total_stock,tpss.product_id
|
|
|
from tb_product_sku_set as tpss
|
|
from tb_product_sku_set as tpss
|
|
|
JOIN tb_product as tp on tp.product_id = tpss.product_id
|
|
JOIN tb_product as tp on tp.product_id = tpss.product_id
|
|
|
Join tb_product_sku_set_stock as tpsss
|
|
Join tb_product_sku_set_stock as tpsss
|
|
|
- on tpss.business_id = tpsss.business_id and tpss.product_id = tpsss.product_id and tpss.sku_hash_code =
|
|
|
|
|
- tpsss.sku_hash_code
|
|
|
|
|
|
|
+ on tpss.business_id = tpsss.business_id and tpss.product_id = tpsss.product_id and tpss.sku_hash_code =tpsss.sku_hash_code
|
|
|
<where>
|
|
<where>
|
|
|
- tp.del_flag = 0 and tp.audit_status = 10
|
|
|
|
|
|
|
+ tp.del_flag = 0 and tp.audit_status = 10 and tp.shelved_status = 1
|
|
|
<if test="businessId != null">
|
|
<if test="businessId != null">
|
|
|
AND tp.business_id = #{businessId}
|
|
AND tp.business_id = #{businessId}
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
|
|
+ GROUP BY tpss.product_id
|
|
|
) as t
|
|
) as t
|
|
|
- where t.stock > 5
|
|
|
|
|
|
|
+ where t.total_stock <= 5
|
|
|
</select>
|
|
</select>
|
|
|
</mapper>
|
|
</mapper>
|