ZengTao
2025-11-17 161f793a51e09acffd3ecd2cbed4be23f93057dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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.mes.damage.mapper.DamageMapper">
 
    <select id="queryUnTempByFlowCardId" resultType="com.mes.damage.entity.Damage">
        SELECT glass_id,
               order_number,
               technology_number,
               working_procedure
        FROM (
                 SELECT glass_id,
                        order_number,
                        technology_number,
                        working_procedure,
                        ROW_NUMBER() OVER (
      PARTITION BY glass_id
      ORDER BY damage_time DESC
    ) AS rn
                 FROM damage
                 WHERE process_id = #{flowCardId}
                   AND glass_id NOT IN (
                     SELECT DISTINCT glass_id
                     FROM damage
                     WHERE process_id = #{flowCardId}
                       AND working_procedure = "钢化"
                 )
             ) t
        WHERE rn = 1;
    </select>
    <select id="selectDamageList" resultType="com.mes.damage.entity.dto.DamageDTO">
        SELECT
        t.*,t1.width,t1.height
        FROM
        damage t left join glass_info t1 on t.glass_id=t1.glass_id
        <where>
            damage_time BETWEEN #{startTime} AND #{endTime}
            <if test="type != null and type != 0">
                AND t.type = #{type}
            </if>
            <if test="status != null and status != 0">
                AND t.status = #{status}
            </if>
            <if test="workingProcedure != null">
                AND t.working_procedure = #{workingProcedure}
            </if>
        </where>
    </select>
</mapper>