liding
4 天以前 a33e38956895c1e4b14894fb1848088578c6d509
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
<?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.InsProductDeviationWarningMapper">
 
    <!-- 查看预警列表 -->
    <select id="selectDeviationWarningPage" resultType="com.ruoyi.inspect.dto.InsProductDeviationWarningDto">
<!--        select *-->
<!--        from (select ipdw.*,-->
<!--        isa.sample                                              sample_name,-->
<!--        isa.model                                               sample_model,-->
<!--        concat(ip.inspection_item, ip.inspection_item_subclass) inspection_item_name-->
<!--        from ins_product_deviation_warning ipdw-->
<!--        left join ins_sample isa on isa.id = ipdw.ins_sample_id-->
<!--        left join ins_product ip On ip.id = ipdw.ins_product_id) a-->
<!--        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">-->
<!--            ${ew.customSqlSegment}-->
<!--        </if>-->
<!--        order by ipdw.detection_time desc-->
        SELECT
        a.*,
        sto.object_type
        FROM (
        SELECT
        ipdw.*,
        sip.sample AS sss,
        isa.sample AS sample_name,
        isa.model AS sample_model,
        CONCAT(ip.inspection_item, ip.inspection_item_subclass) AS inspection_item_name
        FROM ins_product_deviation_warning ipdw
        LEFT JOIN ins_sample isa ON isa.id = ipdw.ins_sample_id
        LEFT JOIN ins_product ip ON ip.id = ipdw.ins_product_id
        LEFT JOIN structure_item_parameter sip ON sip.id = ip.structure_item_parameter_id
        ) a
        LEFT JOIN structure_test_object sto
        ON a.sss LIKE CONCAT('%"', sto.specimen_name, '"%')  -- 模糊匹配
        WHERE
        sto.object_type != 3  -- 过滤条件:排除 object_type 为 3 的记录
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            AND ${ew.customSqlSegment}  -- 动态添加自定义SQL条件
        </if>
        ORDER BY a.detection_time DESC
    </select>
 
</mapper>