wms_server_yaxinke_yangzhou/src/main/resources/mapper/LocationMapper.xml

114 lines
5.6 KiB
XML

<?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.wms.mapper.LocationMapper">
<resultMap type="Location" id="LocationMap">
<result property="locationId" column="location_id"/>
<result property="areaId" column="area_id"/>
<result property="tunnelId" column="tunnel_id"/>
<result property="equipmentId" column="equipment_id"/>
<result property="locationType" column="location_type"/>
<result property="queue" column="queue"/>
<result property="line" column="line"/>
<result property="layer" column="layer"/>
<result property="depth" column="depth"/>
<result property="isLock" column="is_lock"/>
<result property="locationStatus" column="location_status"/>
<result property="vehicleId" column="vehicle_id"/>
</resultMap>
<sql id="selectAll">
select location_id, area_id, tunnel_id, equipment_id, location_type, queue, line, layer, depth, is_lock, location_status, vehicle_id
from tbl_app_location
</sql>
<select id="selLocations" parameterType="Location" resultMap="LocationMap">
<include refid="selectAll"/>
<where>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="areaId != null"> and area_id = #{areaId}</if>
<if test="tunnelId != null"> and tunnel_id = #{tunnelId}</if>
<if test="equipmentId != null"> and equipment_id = #{equipmentId}</if>
<if test="locationType != null"> and location_type = #{locationType}</if>
<if test="queue != null"> and queue = #{queue}</if>
<if test="line != null"> and line = #{line}</if>
<if test="layer != null"> and layer = #{layer}</if>
<if test="depth != null"> and depth = #{depth}</if>
<if test="isLock != null"> and is_lock = #{isLock}</if>
<if test="locationStatus != null"> and location_status = #{locationStatus}</if>
<if test="vehicleId != null and vehicleId != ''"> and vehicle_id = #{vehicleId}</if>
</where>
order by depth desc, line asc, layer asc
</select>
<select id="selSmallDepthLocations" parameterType="Location" resultMap="LocationMap">
<include refid="selectAll"/>
<where>
<if test="areaId != null"> and area_id = #{areaId}</if>
<if test="tunnelId != null"> and tunnel_id = #{tunnelId}</if>
<if test="equipmentId != null"> and equipment_id = #{equipmentId}</if>
<if test="queue != null"> and queue = #{queue}</if>
<if test="line != null"> and line = #{line}</if>
<if test="layer != null"> and layer = #{layer}</if>
<if test="depth != null"> and depth &lt; #{depth}</if>
<if test="isLock != null"> and is_lock = #{isLock}</if>
</where>
order by depth desc, line asc, layer asc
</select>
<select id="selNextLocation" parameterType="Location" resultMap="LocationMap">
<include refid="selectAll"/>
<where>
<if test="areaId != null"> and area_id = #{areaId}</if>
<if test="tunnelId != null"> and tunnel_id = #{tunnelId}</if>
<if test="equipmentId != null"> and equipment_id = #{equipmentId}</if>
<if test="locationType != null"> and location_type = #{locationType}</if>
and is_lock = 0 and location_status = 0
</where>
order by depth desc, layer asc, line desc
for update
</select>
<insert id="addLocation" parameterType="Location">
insert into tbl_app_location
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="locationId != null">location_id,</if>
<if test="areaId != null">area_id,</if>
<if test="tunnelId != null">tunnel_id,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="locationType != null">location_type,</if>
<if test="queue != null">queue,</if>
<if test="line != null">line,</if>
<if test="layer != null">layer,</if>
<if test="depth != null">depth,</if>
<if test="isLock != null">is_lock,</if>
<if test="locationStatus != null">location_status,</if>
<if test="vehicleId != null">vehicle_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="locationId != null">#{locationId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="tunnelId != null">#{tunnelId},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="locationType != null">#{locationType},</if>
<if test="queue != null">#{queue},</if>
<if test="line != null">#{line},</if>
<if test="layer != null">#{layer},</if>
<if test="depth != null">#{depth},</if>
<if test="isLock != null">#{isLock},</if>
<if test="locationStatus != null">#{locationStatus},</if>
<if test="vehicleId != null">#{vehicleId},</if>
</trim>
</insert>
<update id="modifyLocation" parameterType="Location">
update tbl_app_location
<trim prefix="SET" suffixOverrides=",">
<if test="isLock != null">is_lock = #{isLock},</if>
<if test="locationStatus != null">location_status = #{locationStatus},</if>
<if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
</trim>
where location_id = #{locationId}
</update>
</mapper>