skyouc
2025-05-15 c46d1d8c3b9875f051a6ec3c4a1d3fa7bd32e5db
rsf-server/src/main/resources/mapper/manager/QlyIsptItemMapper.xml
@@ -2,4 +2,59 @@
<!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>