自动化立体仓库 - WMS系统
zjj
2023-09-06 914a092bc4c21d69641f94b68fecf61b25ddaca1
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
<?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.mapper.NodeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zy.asrs.entity.Node">
        <id column="id" property="id" />
        <result column="host_id" property="hostId" />
        <result column="uuid" property="uuid" />
        <result column="name" property="name" />
        <result column="parent_id" property="parentId" />
        <result column="parent_name" property="parentName" />
        <result column="type" property="type" />
        <result column="path" property="path" />
        <result column="name_path" property="namePath" />
        <result column="level" property="level" />
        <result column="leading" property="leading" />
        <result column="sort" property="sort" />
        <result column="barcode" property="barcode" />
        <result column="major" property="major" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="create_by" property="createBy" />
        <result column="update_time" property="updateTime" />
        <result column="update_by" property="updateBy" />
        <result column="memo" property="memo" />
        <result column="row1" property="row1" />
        <result column="bay1" property="bay1" />
        <result column="lev1" property="lev1" />
 
    </resultMap>
    <sql id="nodeCondition">
        <if test="host_id != null and host_id != ''">
            and mld.host_id = #{host_id}
        </if>
        <if test="loc_no != null and loc_no != ''">
            and mld.loc_no like concat('%',#{loc_no},'%')
        </if>
        <if test="locNo != null and locNo != ''">
            and mld.loc_no like concat('%',#{loc_no},'%')
        </if>
        <if test="matnr != null and matnr != ''">
            and mld.matnr like concat('%',#{matnr},'%')
        </if>
        <if test="maktx != null and maktx != ''">
            and mld.maktx like concat('%',#{maktx},'%')
        </if>
        <if test="startTime!=null and endTime!=null">
            and mld.update_time between #{startTime} and #{endTime}
        </if>
    </sql>
 
    <select id="selectByUuid" resultMap="BaseResultMap">
        select * from man_node where 1=1 and uuid=#{uuid} and host_id = #{hostId} and status = 1
    </select>
    <select id="listByPage" resultMap="BaseResultMap">
        select * from
        (
        SELECT
        ROW_NUMBER() over (order by mld.create_time desc) as row,
        mld.*
        FROM man_loc_detl mld
        LEFT JOIN man_node mn ON mld.node_id = mn.id
        LEFT JOIN man_mat mm ON mld.matnr = mm.matnr
        LEFT JOIN man_tag mt ON mm.tag_id = mt.id
        WHERE 1=1
        AND (CHARINDEX(','+#{node_id}+',', ','+mn.path+',') > 0 OR mn.id = #{node_id})
        AND (CHARINDEX(','+#{tag_id}+',', ','+mt.path+',') > 0 OR mt.id = #{tag_id})
        <include refid="nodeCondition"></include>
        ) t where t.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
    </select>
 
    <select id="listByPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
        select
        count(1)
        FROM man_loc_detl mld
        LEFT JOIN man_node mn ON mld.node_id = mn.id
        LEFT JOIN man_mat mm ON mld.matnr = mm.matnr
        LEFT JOIN man_tag mt ON mm.tag_id = mt.id
        WHERE 1=1
        AND (CHARINDEX(','+#{node_id}+',', ','+mn.path+',') > 0 OR mn.id = #{node_id})
        AND (CHARINDEX(','+#{tag_id}+',', ','+mt.path+',') > 0 OR mt.id = #{tag_id})
        <include refid="nodeCondition"></include>
    </select>
    <select id="getRommendLoc" resultType="java.lang.String">
        select name from man_node
        where level = 3 and parent_name = 'C'
    </select>
 
</mapper>