新增双向统计接口

This commit is contained in:
2025-10-29 14:40:09 +08:00
parent 2c49f4d600
commit 3ca854f85f
5 changed files with 60 additions and 28 deletions

View File

@@ -45,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
w.warehouse_id,
w.warehouse_name,
mc.item_type,
mc.item_id,
COUNT(mc.coil_id) as coil_count,
COALESCE(SUM(mc.gross_weight), 0) as total_gross_weight,
COALESCE(SUM(mc.net_weight), 0) as total_net_weight
@@ -53,14 +54,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mc.data_type = 1
AND mc.del_flag = '0'
WHERE w.del_flag = '0'
GROUP BY w.warehouse_id, w.warehouse_name, mc.item_type
ORDER BY w.warehouse_id, mc.item_type
<if test="itemType != null and itemType != ''">
AND mc.item_type = #{itemType}
</if>
<if test="itemId != null">
AND mc.item_id = #{itemId}
</if>
GROUP BY w.warehouse_id, w.warehouse_name, mc.item_type, mc.item_id
ORDER BY w.warehouse_id, mc.item_type, mc.item_id
</select>
<!-- 查询不同类型的钢卷在不同库区的分布情况 -->
<select id="getDistributionByItemType" resultType="java.util.Map">
SELECT
mc.item_type,
mc.item_id,
w.warehouse_id,
w.warehouse_name,
COUNT(mc.coil_id) as coil_count,
@@ -71,8 +79,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE mc.data_type = 1
AND mc.del_flag = '0'
AND (w.del_flag = '0' OR w.del_flag IS NULL)
GROUP BY mc.item_type, w.warehouse_id, w.warehouse_name
ORDER BY mc.item_type, w.warehouse_id
<if test="itemType != null and itemType != ''">
AND mc.item_type = #{itemType}
</if>
<if test="itemId != null">
AND mc.item_id = #{itemId}
</if>
GROUP BY mc.item_type, mc.item_id, w.warehouse_id, w.warehouse_name
ORDER BY mc.item_type, mc.item_id, w.warehouse_id
</select>
</mapper>