新增双向统计接口
This commit is contained in:
@@ -29,6 +29,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 统计查询专用的ResultMap -->
|
||||
<resultMap type="com.klp.domain.vo.WmsMaterialCoilVo" id="WmsMaterialCoilDistributionResult">
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="itemType" column="item_type"/>
|
||||
<result property="coilCount" column="coil_count"/>
|
||||
<result property="totalGrossWeight" column="total_gross_weight"/>
|
||||
<result property="totalNetWeight" column="total_net_weight"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询各个库区中不同类型的钢卷分布情况 -->
|
||||
<select id="getDistributionByWarehouse" resultType="java.util.Map">
|
||||
SELECT
|
||||
w.warehouse_id,
|
||||
w.warehouse_name,
|
||||
mc.item_type,
|
||||
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
|
||||
FROM wms_warehouse w
|
||||
LEFT JOIN wms_material_coil mc ON w.warehouse_id = mc.warehouse_id
|
||||
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
|
||||
</select>
|
||||
|
||||
<!-- 查询不同类型的钢卷在不同库区的分布情况 -->
|
||||
<select id="getDistributionByItemType" resultType="java.util.Map">
|
||||
SELECT
|
||||
mc.item_type,
|
||||
w.warehouse_id,
|
||||
w.warehouse_name,
|
||||
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
|
||||
FROM wms_material_coil mc
|
||||
LEFT JOIN wms_warehouse w ON mc.warehouse_id = w.warehouse_id
|
||||
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
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user