zhangf
2024-05-08 0414ddb0b2b3a7199ae6181a770f97ac140dbd73
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
<?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.gkhy.safePlatform.equipment.repository.MaterialReceiveRecordsInfoRepository">
 
    <resultMap type="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsInfo" id="resultMap">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="material_name" property="materialName" jdbcType="VARCHAR"/>
        <result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
        <result column="rfid" property="rfid" jdbcType="VARCHAR"/>
        <result column="revert_status" property="revertStatus" jdbcType="TINYINT"/>
        <result column="material_status" property="materialStatus" jdbcType="TINYINT"/>
        <result column="smd_id" property="smdId" jdbcType="BIGINT"/>
        <result column="receive_uid" property="receiveUid" jdbcType="BIGINT"/>
        <result column="receive_uname" property="receiveUname" jdbcType="VARCHAR"/>
        <result column="receive_time" property="receiveTime" jdbcType="TIMESTAMP"/>
        <result column="receive_base_id" property="receiveBaseId" jdbcType="BIGINT"/>
        <result column="remark" property="remark" jdbcType="VARCHAR"/>
        <result column="revert_time" property="revertTime" jdbcType="TIMESTAMP"/>
 
    </resultMap>
    <select id="getRecordBySmdId" resultType="com.gkhy.safePlatform.equipment.entity.MaterialDeliveryRecordDO">
        select
            r.id as receiveId,
            r.material_name,
            r.rfid,
            r.smd_id,
            b.id as receiveBaseId,
            b.revert_count,
            b.receive_count,
            b.receive_uid,
            b.status,
            b.receive_uname,
            b.create_time as receiveTime
        from material_receive_records r
        inner join material_receive_records_base b
        on r.receive_base_id = b.id
        where r.smd_id = #{smdId}
        and r.revert_status = #{revertStatus}
    </select>
    <select id="getNoReturnRecordByIds" resultType="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO">
        SELECT
            r.id ,
            r.material_name,
            r.rfid,
            r.smd_id,
            r.material_status,
            r.revert_status,
            r.receive_uid,
            r.receive_uname,
            r.receive_time,
            r.remark,
            r.revert_time,
            s.valid_status
        FROM
            material_receive_records r
                INNER JOIN safe_material_detail s ON r.smd_id = s.id
        WHERE
            r.id in
            <foreach collection="idList" item="id" open="(" close=")" separator=",">
                #{id}
            </foreach>
          and r.revert_status = #{revertStatus}
    </select>
    <select id="getReceiveRecordsByReceiveUids" resultType="com.gkhy.safePlatform.equipment.entity.MaterialReceiveRecordsDO">
        SELECT
            r.id,
            r.material_no,
            r.material_name,
            r.rfid,
            r.receive_uid,
            r.receive_uname,
            r.smd_id,
            d.small_classify_id,
            d.big_classify_id,
            d.consumable,
            c.material_classify_name as bigClassifyName
        FROM
            material_receive_records r
                LEFT JOIN safe_material_detail d ON r.smd_id = d.id
            LEFT JOIN safe_material_classify c on d.big_classify_id = c.id
        where r.revert_status = 1 and r.receive_uid in
        <foreach collection="receiveUids" item="receiveUid" separator="," open="(" close=")">
            #{receiveUid}
        </foreach>
         and d.small_classify_id in
        <foreach collection="smallClassifyIds" item="smallClassifyId" separator="," open="(" close=")">
            #{smallClassifyId}
        </foreach>
    </select>
 
 
</mapper>