LocationMapper.xml
2.03 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
<?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>
</mapper>