yangys
2025-11-18 8e944cfabb253fc2556588e308e282586043f7b0
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
<?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.qianwen.smartman.modules.smis.mapper.MaterialStorageMapper">
 
 
    <select id="listMaterial" resultType="com.qianwen.smartman.modules.smis.vo.WareMaterialStorageVO">
        select bms.id,
        material_id materialId,
        warehouse_station_id warehouseStationId,
        bm.code materialCode,
        bm.name materialName,
        standard_model materialStandardModel,
        unit materialUnit,
        type_id typeId,
        lower_limit lowerLimit,
        upper_limit upperLimit,
        is_must_check isMustCheck,
        property,
        bmt.code typeCode,
        bmt.name typeName
        from blade_material_storage bms
        INNER JOIN blade_material bm ON bms.material_id = bm.id
        LEFT JOIN blade_material_type bmt on bm.type_id = bmt.id and bmt.is_deleted = 0
        where bms.is_deleted = 0
        and bm.is_deleted = 0
        and warehouse_station_id = #{wareId}
        <if test="keyword != null and keyword != ''">
            and (bm.code like concat(#{keyword}, '%') or bm.name like concat(#{keyword}, '%'))
        </if>
    </select>
 
    <select id="materialNotBind" resultType="com.qianwen.smartman.modules.smis.vo.MaterialVO">
        select id,
               code,
               bar_code       barCode,
               name,
               type_id        typeId,
               unit,
               stuff,
               standard_model standardModel,
               remark,
               lower_limit    lowerLimit,
               upper_limit    upperLimit,
               is_must_check  isMustCheck,
               property
        from blade_material bm
        where bm.is_deleted = 0
          and bm.status = 1
          and not exists(select bms.material_id
                         from blade_material_storage bms
                         where bms.is_deleted = 0
                           and bm.id = bms.material_id)
        order by bm.create_time desc;
    </select>
 
    <select id="pageMaterial" resultType="com.qianwen.smartman.modules.smis.vo.WareMaterialStorageVO">
        select bms.id,
        material_id materialId,
        warehouse_station_id warehouseStationId,
        bm.code materialCode,
        bm.name materialName,
        standard_model materialStandardModel,
        unit materialUnit,
        type_id typeId,
        lower_limit lowerLimit,
        upper_limit upperLimit,
        is_must_check isMustCheck,
        property,
        bmt.code typeCode,
        bmt.name typeName
        from blade_material_storage bms
        INNER JOIN blade_material bm ON bms.material_id = bm.id
        LEFT JOIN blade_material_type bmt on bm.type_id = bmt.id and bmt.is_deleted = 0
        where bms.is_deleted = 0
        and bm.is_deleted = 0
        and warehouse_station_id = #{wareId}
        <if test="keyword != null and keyword != ''">
            and (bm.code like concat(#{keyword}, '%') or bm.name like concat(#{keyword}, '%'))
        </if>
        order by bm.create_time desc , bm.id desc;
    </select>
</mapper>