skyouc
2025-07-07 2a24c69b830d9dc97a8673f5f69418e9f95f3e1b
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
95
96
97
98
99
100
101
102
103
104
105
106
107
<?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.zy.asrs.wms.asrs.mapper.ViewLocDetlMapper">
 
    <select id="queryStock" resultType="map">
        SELECT * FROM
        (
        SELECT id, loc_id, loc_no, mat_id, IFNULL(type_id, 4) AS type_id, work_qty, matnr, order_no, batch, anfme, host_id, memo,deleted,create_time, freeze
        FROM
        view_man_loc_detl
        ) t
        WHERE t.deleted = 0 AND t.freeze = 0 AND type_id = #{type}
        <if test="matnr != null and matnr != ''">
            AND t.matnr = #{matnr}
        </if>
        <if test="batch != null and batch != ''">
            AND t.batch = #{batch}
        </if>
        <if test="sortParam!=null and sortParam.size()>0">
            <foreach collection="sortParam" item="item" open="order by " separator="," close="  ">
                ${item.name}  ${item.value}
            </foreach>
        </if>
        ORDER BY
        t.create_time ASC
    </select>
 
    <select id="getList" resultType="map">
        select * from view_man_loc_detl ld
        where matnr = #{matnr}
        <if test="batch!=null and batch != ''">
            and batch = #{batch}
        </if>
        <if test="param!=null and param.size()>0">
            <foreach item="item" collection="param" index="index">
                <if test="item.value !=null and item.value != ''">
                    and ${item.name} = #{item.value}
                </if>
            </foreach>
        </if>
        <if test="sortParam!=null and sortParam.size()>0">
            <foreach collection="sortParam" item="item" open="order by " separator="," close="  ">
                ${item.name} ${item.value}
            </foreach>
        </if>
    </select>
 
    <select id="getListLike" resultType="map">
        select * from view_man_loc_detl ld
        where matnr = #{matnr}
        <if test="batch!=null">
            and batch = #{batch}
        </if>
        <if test="param!=null and param.size()>0">
            <foreach item="item" collection="param" index="index">
                and ${item.name} like CONCAT('%',#{item.value},'%')
            </foreach>
        </if>
    </select>
 
    <select id="getById" resultType="map">
        select *
        from view_man_loc_detl
        where id = #{id}
    </select>
 
 
    <select id="listSuitableMat" resultType="map">
        select * from view_man_loc_detl ld
        where 1=1
        <if test="param!=null and param.size()>0">
            <foreach item="item" collection="param" index="index">
                and ${item.name} ${type} #{item.value}
            </foreach>
        </if>
        <if test="sortParam!=null and sortParam.size()>0">
            <foreach collection="sortParam" item="order" open="order by " separator="," close="  ">
                ${item.name} #{item.value}
            </foreach>
        </if>
    </select>
    <select id="queryFlatStock" resultType="map">
        SELECT * FROM
        (
        SELECT id, loc_id, loc_no, mat_id, type_id, work_qty, matnr, order_no, batch, anfme, host_id, memo,create_time,  freeze
        FROM
        view_man_loc_detl
        WHERE
        deleted = 0
        AND type_id IN ( SELECT id FROM man_loc_area_type WHERE parent_id = #{typeId} OR id = #{typeId} )
        ) t
        WHERE 1 = 1
        <if test="matnr != null and matnr != ''">
            AND t.matnr = #{matnr}
        </if>
        <if test="batch != null and batch != ''">
            AND t.batch = #{batch}
        </if>
        <!--        <if test="params != null and params.size() > 0">-->
        <!--            <foreach collection="params" item="item" open="in " separator="," close="  ">-->
        <!--                ${item.name} #{item.value}-->
        <!--            </foreach>-->
        <!--        </if>-->
        ORDER BY
        t.create_time ASC
    </select>
</mapper>