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
<?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.vincent.rsf.server.manager.mapper.QlyIsptItemMapper">
 
    <select id="pageByWrapper" resultType="com.vincent.rsf.server.manager.entity.QlyIsptItem">
        SELECT *
        FROM (SELECT qii.id,
                     ispect_id,
                     asn_item_id,
                     matnr_code,
                     maktx,
                     splr_name,
                     splr_batch,
                     qir.anfme,
                     qir.ispt_result,
                     rcpt_qty,
                     dly_qty,
                     track_code,
                     pic_path,
                     `status`,
                     deleted,
                     tenant_id,
                     create_by,
                     create_time,
                     update_by,
                     update_time,
                     memo
              FROM man_qly_ispt_item qii
                       LEFT JOIN man_qly_inspect_result qir ON qii.id = qir.ispt_item_id) t
            ${ew.customSqlSegment}
    </select>
    <select id="selectIsptResult" resultType="com.vincent.rsf.server.manager.entity.QlyIsptItem">
        SELECT *
        FROM (SELECT qii.id,
                     ispect_id,
                     asn_item_id,
                     matnr_code,
                     maktx,
                     qii.rcpt_id,
                     splr_name,
                     splr_batch,
                     rcpt_qty,
                     dly_qty,
                     track_code,
                     pic_path,
                     `status`,
                     deleted,
                     tenant_id,
                     create_by,
                     COALESCE((SELECT anfme FROM man_qly_inspect_result WHERE qii.id = ispt_item_id AND ispt_result = 1), 0)  AS safe_qty,
                     COALESCE((SELECT anfme FROM man_qly_inspect_result WHERE qii.id = ispt_item_id AND ispt_result = 2), 0) AS dis_qty,
                     create_time,
                     update_by,
                     update_time,
                     memo
              FROM man_qly_ispt_item qii) t
            ${ew.customSqlSegment}
 
    </select>
</mapper>