LocationMapper.xml
5.43 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?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.huaheng.pc.general.location.mapper.LocationMapper">
<select id="getEmptyContainerInLocation" resultType="com.huaheng.pc.general.location.domain.Location">
SELECT * FROM location t
<where>
t.warehouseId = #{warehouseId} AND t.status='empty' AND t.containerCode !='' AND t.containerCode is not NULL
AND t.`code` NOT in (SELECT b.locationCode FROM inventory b WHERE b.warehouseId = #{warehouseId} )
<if test="containerCode != null and containerCode !=''">
<bind name="temp1" value="'%' + containerCode + '%'" />
and t.containerCode like #{temp1}
</if>
<if test="locationCode != null and locationCode !=''">
<bind name="temp2" value="'%' + locationCode + '%'" />
and t.`code` like #{temp2}
</if>
</where>
</select>
<update id="updateStatus">
UPDATE location set `status`=#{status} WHERE warehouseCode=#{warehouseCode} AND `code`=#{code}
</update>
<update id="updateContainerCodeAndStatus">
UPDATE location set `status`=#{status},containerCode=#{containerCode} WHERE warehouseCode=#{warehouseCode} AND `code`=#{locationCode}
</update>
<update id="updateContainerCode">
UPDATE location set containerCode=#{containerCode} WHERE warehouseCode=#{warehouseCode} AND `code`=#{locationCode}
</update>
<select id="getEmptyLocation" resultType="com.huaheng.pc.general.location.domain.Location">
select * from location l
<where>
l.containerCode = "" AND l.warehouseId = #{warehouseId} AND l.deleted = #{deleted} AND l.status = #{status}
<if test="locationCode != null and locationCode !=''">
<bind name="temp2" value="'%' + locationCode + '%'" />
and l.`code` like #{temp2}
</if>
</where>
</select>
<select id="getAllLocation" resultType="com.huaheng.pc.general.location.domain.Location">
select max(row) as row,max(line) as line,max(layer) as layer,max(grid) as grid from location l where l.warehouseCode= #{warehouseCode} AND l.type=#{type}
</select>
<select id="selectSSPLocation" resultType="com.huaheng.pc.general.location.domain.Location">
SELECT * FROM `location` WHERE zoneCode = 'QG' AND `status` = 'empty' ORDER BY `row` LIMIT 1
</select>
<select id="getAllLocationCode" resultType="java.lang.String">
SELECT code
FROM location
<where>
<if test="id != null">
AND id = #{id}
</if>
<if test="code != null">
AND code = #{code}
</if>
<if test="warehouseId != null">
AND warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null">
AND warehouseCode = #{warehouseCode}
</if>
<if test="row != null">
AND row = #{row}
</if>
<if test="line != null">
AND line = #{line}
</if>
<if test="layer != null">
AND layer = #{layer}
</if>
<if test="grid != null">
AND grid = #{grid}
</if>
<if test="rowIndex != null">
AND rowIndex = #{rowIndex}
</if>
<if test="roadway != null">
AND roadway = #{roadway}
</if>
<if test="type != null">
AND type = #{type}
</if>
<if test="containerId != null">
AND containerId = #{containerId}
</if>
<if test="containerCode != null">
AND containerCode = #{containerCode}
</if>
<if test="zoneId != null">
AND zoneId = #{zoneId}
</if>
<if test="zoneCode != null">
AND zoneCode = #{zoneCode}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="lastCycleCountDate != null">
AND lastCycleCountDate = #{lastCycleCountDate}
</if>
<if test="created != null">
AND created = #{created}
</if>
<if test="createdBy != null">
AND createdBy = #{createdBy}
</if>
<if test="lastUpdated != null">
AND lastUpdated = #{lastUpdated}
</if>
<if test="lastUpdatedBy != null">
AND lastUpdatedBy = #{lastUpdatedBy}
</if>
<if test="enable != null">
AND enable = #{enable}
</if>
<if test="deleted != null">
AND deleted = #{deleted}
</if>
<if test="userDef1 != null">
AND userDef1 = #{userDef1}
</if>
<if test="userDef2 != null">
AND userDef2 = #{userDef2}
</if>
<if test="userDef3 != null">
AND userDef3 = #{userDef3}
</if>
<if test="userDef4 != null">
AND userDef4 = #{userDef4}
</if>
<if test="userDef5 != null">
AND userDef5 = #{userDef5}
</if>
</where>
</select>
</mapper>