zouyu
2026-01-30 5bd1e846de7587f39d3edacfed58bfa8325c8758
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?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.contract,
                iiq.order_no,
                iiq.order_type,
                iiq.material_prop,
                iiq.line_no,
                iiq.release_no,
                iiq.receipt_no,
                iiq.part_no,
                iiq.part_desc,
                iiq.status,
                iiq.status_db,
                iiq.qty_arrived,
                iiq.qty_inspected,
                iiq.qty_to_inspect,
                iiq.supplier_id,
                iiq.supplier_name,
                iiq.inv_qty_in_store,
                iiq.pur_qty_in_store,
                iiq.configuration_id,
                iiq.lot_batch_no,
                iiq.waiv_dev_rej_no,
                iiq.activity_seq,
                iiq.serial_no,
                iiq.location_no,
                iiq.eng_chg_level,
                iiq.receiver,
                iiq.receiver_name,
                iiq.buyer_code,
                iiq.buyer_name,
                iiq.arrive_date,
                iiq.delivery_date,
                iiq.product_date,
                iiq.invalid_date,
                iiq.approved_date,
                iiq.req_ceater,
                iiq.req_ceater_name,
                iiq.line_remarks,
                iiq.buy_unit_meas,
                iiq.is_source,
                iiq.number,
                iiq.state,
                iiq.receiver_date,
                iiq.is_first,
                iiq.to_location,
                iiq.is_inspect,
                iiq.declare_user,
                iiq.declare_user_id,
                iiq.part_unit,
                iiq.industry_chain,
                iiq.declare_date,
                iiq.is_quarter,
                iiq.is_copper,
                iiq.update_batch_no,
                iiq.is_finish,
                iiq.inspect_status,
                iiq.is_register,
                iiq.is_update_batch,
                iiq.is_expire,
                iiq.is_split_order,
                iuh.id,
                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>