zouyu
2026-01-29 68d6ddbe1610b66e75ee05ad75998ce1a3caadba
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?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.ruoyi.inspect.mapper.InsUnqualifiedHandlerMapper">
 
    <sql id="Base_Column_List">
        id,no,supplier_name,
        material_name,production_batch,cargo_quantity,
        specs_models,inspect_time,feedback_user,
        feedback_time,classification,off_grade_ascription,
        unqualified_desc,inventory_quantity_id
    </sql>
    <select id="selectPageList" resultType="com.ruoyi.inspect.vo.UnqualifiedHandlerVO">
        select
            *
        from (
            select
                iiq.*,
                iuh.id as handler_id,
                iuh.no,
                iuh.material_name,
                iuh.production_batch,
                iuh.cargo_quantity,
                iuh.specs_models,
                iuh.inspect_time,
                iuh.feedback_user,
                iuh.feedback_time,
                iuh.classification,
                iuh.off_grade_ascription,
                iuh.unqualified_desc,
                iuh.inventory_quantity_id,
                iuh.oa_state,
                iuh.request_id,
                iuh.file_url,
                iuh.headline,
                coa.operation
            from
                ins_unqualified_handler iuh
            inner join
                ifs_inventory_quantity iiq
            on
                iuh.inventory_quantity_id = iiq.id
            LEFT JOIN (
            SELECT
            *,
            ROW_NUMBER() OVER (PARTITION BY workflow_id ORDER BY approval_date DESC,approval_time DESC, id DESC) AS rn
            FROM
            common_oa
            ) AS coa ON iuh.request_id = coa.workflow_id AND coa.rn = 1
        )tempA
        <where>
            <if test="feedbackStartDate!=null and feedbackEndDate !=null">
                AND feedback_time between #{feedbackStartDate} AND #{feedbackEndDate}
            </if>
        </where>
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
        order by id desc
    </select>
    <select id="findById" resultType="com.ruoyi.inspect.vo.UnqualifiedHandlerVO">
        select * from (select
        iiq.*,
        iuh.id as handler_id,
        iuh.no,
        iuh.headline,
        iuh.material_name,
        iuh.production_batch,
        iuh.cargo_quantity,
        iuh.specs_models,
        iuh.inspect_time,
        iuh.feedback_user,
        iuh.feedback_time,
        iuh.classification,
        iuh.off_grade_ascription,
        iuh.unqualified_desc,
        iuh.inventory_quantity_id,
        iuh.request_id,
        iuh.oa_state,
        iuh.file_url
        from
        ins_unqualified_handler iuh
        inner join
        ifs_inventory_quantity iiq
        on
        iuh.inventory_quantity_id = iiq.id)tempA
        where tempA.handler_id = #{id}
    </select>
    <select id="getOaFlow" resultType="com.ruoyi.inspect.pojo.CommonOa">
        select co.id,
               co.node_name,
               co.operation,
               co.approver,
               co.approval_date,
               co.approval_time,
               co.approval_opinion,
               co.workflow_id
        from common_oa co
                 left join ins_unqualified_handler iuh on iuh.request_id = co.workflow_id
        where iuh.id = #{id}
        and operation != '抄送'
        group by co.node_name
    </select>
</mapper>