- 移除Mapper中废弃的warehouseId筛选条件 - 删除无用的wms_furnace_plan_coil关联查询 - 修复服务层出炉逻辑库区筛选逻辑 - 添加正确的退火计划钢卷库区匹配验证 - 优化钢卷筛选条件确保数据准确性 - 调整查询性能避免不必要的表连接
47 lines
1.9 KiB
XML
47 lines
1.9 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.klp.mapper.WmsAnnealPerformanceMapper">
|
|
|
|
<sql id="AnnealPerformanceWhere">
|
|
<where>
|
|
p.del_flag = 0
|
|
<if test="startTime != null">
|
|
AND p.actual_start_time <![CDATA[>=]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
AND p.actual_start_time <![CDATA[<=]]> #{endTime}
|
|
</if>
|
|
<if test="targetFurnaceId != null">
|
|
AND p.target_furnace_id = #{targetFurnaceId}
|
|
</if>
|
|
<if test="planNo != null and planNo != ''">
|
|
AND p.plan_no LIKE CONCAT('%', #{planNo}, '%')
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="selectSummary" resultType="com.klp.domain.vo.anneal.WmsAnnealPerformanceSummaryVo">
|
|
SELECT COUNT(DISTINCT p.plan_id) AS plan_count,
|
|
COUNT(mc.coil_id) AS coil_count,
|
|
COALESCE(SUM(mc.net_weight), 0) AS total_weight
|
|
FROM wms_furnace_plan p
|
|
INNER JOIN wms_furnace_plan_coil pc ON pc.plan_id = p.plan_id AND pc.del_flag = 0
|
|
INNER JOIN wms_material_coil mc ON mc.coil_id = pc.coil_id AND mc.del_flag = 0
|
|
<include refid="AnnealPerformanceWhere" />
|
|
</select>
|
|
|
|
<select id="selectDetails" resultType="com.klp.domain.vo.anneal.WmsAnnealPerformanceDetailVo">
|
|
SELECT p.plan_id AS planId,
|
|
p.plan_no AS planNo,
|
|
p.target_furnace_id AS targetFurnaceId,
|
|
f.furnace_name AS targetFurnaceName,
|
|
p.actual_start_time AS actualStartTime,
|
|
p.end_time AS endTime
|
|
FROM wms_furnace_plan p
|
|
LEFT JOIN wms_furnace f ON f.furnace_id = p.target_furnace_id
|
|
<include refid="AnnealPerformanceWhere" />
|
|
GROUP BY p.plan_id, p.plan_no, p.target_furnace_id, f.furnace_name, p.actual_start_time, p.end_time
|
|
ORDER BY p.actual_start_time DESC, p.plan_no DESC
|
|
</select>
|
|
</mapper>
|