257 lines
12 KiB
XML
257 lines
12 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.ruoyi.app.mapper.AppLocationMapper">
|
|
|
|
<resultMap type="AppLocation" id="AppLocationResult">
|
|
<result property="id" column="id"/>
|
|
<result property="locationId" column="location_id"/>
|
|
<result property="locationType" column="location_type"/>
|
|
<result property="locationStatus" column="location_status"/>
|
|
<result property="outerId" column="outer_id"/>
|
|
<result property="areaId" column="area_id"/>
|
|
<result property="tunnelId" column="tunnel_id"/>
|
|
<result property="equipmentId" column="equipment_id"/>
|
|
<result property="wRow" column="w_row"/>
|
|
<result property="wCol" column="w_col"/>
|
|
<result property="wLayer" column="w_layer"/>
|
|
<result property="wDepth" column="w_depth"/>
|
|
<result property="isLock" column="is_lock"/>
|
|
<result property="vehicleId" column="vehicle_id"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="isWorking" column="is_working"/>
|
|
<result property="isEnable" column="is_enable"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectAppLocationVo">
|
|
select id,
|
|
location_id,
|
|
location_type,
|
|
location_status,
|
|
outer_id,
|
|
area_id,
|
|
tunnel_id,
|
|
equipment_id,
|
|
w_row,
|
|
w_col,
|
|
w_layer,
|
|
w_depth,
|
|
is_lock,
|
|
vehicle_id,
|
|
remark,
|
|
is_working,
|
|
is_enable
|
|
from app_location
|
|
</sql>
|
|
|
|
<select id="selectAppLocationList" parameterType="AppLocation" resultMap="AppLocationResult">
|
|
<include refid="selectAppLocationVo"/>
|
|
<where>
|
|
<if test="locationId != null ">and location_id = #{locationId}</if>
|
|
<if test="locationType != null ">and location_type = #{locationType}</if>
|
|
<if test="locationStatus != null ">and location_status = #{locationStatus}</if>
|
|
<if test="outerId != null and outerId != ''">and outer_id = #{outerId}</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="wRow != null ">and w_row = #{wRow}</if>
|
|
<if test="wCol != null ">and w_col = #{wCol}</if>
|
|
<if test="wLayer != null ">and w_layer = #{wLayer}</if>
|
|
<if test="wDepth != null ">and w_depth = #{wDepth}</if>
|
|
<if test="isLock != null ">and is_lock = #{isLock}</if>
|
|
<if test="vehicleId != null and vehicleId != ''">and vehicle_id = #{vehicleId}</if>
|
|
<if test="isWorking != null ">and is_working = #{isWorking}</if>
|
|
<if test="isEnable != null ">and is_enable = #{isEnable}</if>
|
|
</where>
|
|
order by
|
|
w_layer asc,
|
|
w_col asc,
|
|
w_depth desc,
|
|
w_row asc
|
|
</select>
|
|
|
|
<select id="selectAppLocationById" parameterType="String" resultMap="AppLocationResult">
|
|
<include refid="selectAppLocationVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
<select id="selectAppLocationByLocationId" parameterType="String" resultMap="AppLocationResult">
|
|
<include refid="selectAppLocationVo"/>
|
|
where location_id = #{locationId}
|
|
</select>
|
|
<select id="selectFreeLoc" resultMap="AppLocationResult">
|
|
<include refid="selectAppLocationVo"/>
|
|
where location_status = 0 and is_working = 0 and is_enable = 0
|
|
and location_id NOT IN ( SELECT DISTINCT ( t.location_id ) FROM app_stock t UNION SELECT DISTINCT ( p.location_id ) FROM app_task p where p.location_id is not null)
|
|
ORDER BY
|
|
w_depth DESC,
|
|
w_layer ASC,
|
|
w_col asc
|
|
</select>
|
|
<select id="countAvailableStock" resultType="java.util.Map">
|
|
SELECT
|
|
(SELECT COUNT(*) FROM app_location) AS total_count,
|
|
(SELECT COUNT(*) FROM app_location WHERE location_status = 0) AS available_count
|
|
</select>
|
|
|
|
|
|
<insert id="insertAppLocation" parameterType="AppLocation">
|
|
insert into app_location
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="locationId != null">location_id,</if>
|
|
<if test="locationType != null">location_type,</if>
|
|
<if test="locationStatus != null">location_status,</if>
|
|
<if test="outerId != null">outer_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="wRow != null">w_row,</if>
|
|
<if test="wCol != null">w_col,</if>
|
|
<if test="wLayer != null">w_layer,</if>
|
|
<if test="wDepth != null">w_depth,</if>
|
|
<if test="isLock != null">is_lock,</if>
|
|
<if test="vehicleId != null">vehicle_id,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="isWorking != null">is_working,</if>
|
|
<if test="isEnable != null">is_enable,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="locationId != null">#{locationId},</if>
|
|
<if test="locationType != null">#{locationType},</if>
|
|
<if test="locationStatus != null">#{locationStatus},</if>
|
|
<if test="outerId != null">#{outerId},</if>
|
|
<if test="areaId != null">#{areaId},</if>
|
|
<if test="tunnelId != null">#{tunnelId},</if>
|
|
<if test="equipmentId != null">#{equipmentId},</if>
|
|
<if test="wRow != null">#{wRow},</if>
|
|
<if test="wCol != null">#{wCol},</if>
|
|
<if test="wLayer != null">#{wLayer},</if>
|
|
<if test="wDepth != null">#{wDepth},</if>
|
|
<if test="isLock != null">#{isLock},</if>
|
|
<if test="vehicleId != null">#{vehicleId},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="isWorking != null">#{isWorking},</if>
|
|
<if test="isEnable != null">#{isEnable},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<insert id="insertAppLocationBatch" parameterType="java.util.List">
|
|
<foreach collection="list" item="location" separator=";">
|
|
insert into app_location
|
|
(
|
|
<trim prefixOverrides="," suffixOverrides=",">
|
|
<if test="location.id != null">id,</if>
|
|
<if test="location.locationId != null">location_id,</if>
|
|
<if test="location.locationType != null">location_type,</if>
|
|
<if test="location.locationStatus != null">location_status,</if>
|
|
<if test="location.outerId != null">outer_id,</if>
|
|
<if test="location.areaId != null">area_id,</if>
|
|
<if test="location.tunnelId != null">tunnel_id,</if>
|
|
<if test="location.equipmentId != null">equipment_id,</if>
|
|
<if test="location.wRow != null">w_row,</if>
|
|
<if test="location.wCol != null">w_col,</if>
|
|
<if test="location.wLayer != null">w_layer,</if>
|
|
<if test="location.wDepth != null">w_depth,</if>
|
|
<if test="location.isLock != null">is_lock,</if>
|
|
<if test="location.vehicleId != null">vehicle_id,</if>
|
|
<if test="location.remark != null">remark,</if>
|
|
<if test="location.isWorking != null">is_working,</if>
|
|
<if test="location.isEnable != null">is_enable,</if>
|
|
</trim>
|
|
)
|
|
values
|
|
(
|
|
<trim prefixOverrides="," suffixOverrides=",">
|
|
<if test="location.id != null">#{location.id},</if>
|
|
<if test="location.locationId != null">#{location.locationId},</if>
|
|
<if test="location.locationType != null">#{location.locationType},</if>
|
|
<if test="location.locationStatus != null">#{location.locationStatus},</if>
|
|
<if test="location.outerId != null">#{location.outerId},</if>
|
|
<if test="location.areaId != null">#{location.areaId},</if>
|
|
<if test="location.tunnelId != null">#{location.tunnelId},</if>
|
|
<if test="location.equipmentId != null">#{location.equipmentId},</if>
|
|
<if test="location.wRow != null">#{location.wRow},</if>
|
|
<if test="location.wCol != null">#{location.wCol},</if>
|
|
<if test="location.wLayer != null">#{location.wLayer},</if>
|
|
<if test="location.wDepth != null">#{location.wDepth},</if>
|
|
<if test="location.isLock != null">#{location.isLock},</if>
|
|
<if test="location.vehicleId != null">#{location.vehicleId},</if>
|
|
<if test="location.remark != null">#{location.remark},</if>
|
|
<if test="location.isWorking != null">#{location.isWorking},</if>
|
|
<if test="location.isEnable != null">#{location.isEnable},</if>
|
|
</trim>
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateAppLocation" parameterType="AppLocation">
|
|
update app_location
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="locationId != null">location_id = #{locationId},</if>
|
|
<if test="locationType != null">location_type = #{locationType},</if>
|
|
<if test="locationStatus != null">location_status = #{locationStatus},</if>
|
|
<if test="outerId != null">outer_id = #{outerId},</if>
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
|
<if test="tunnelId != null">tunnel_id = #{tunnelId},</if>
|
|
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
|
|
<if test="wRow != null">w_row = #{wRow},</if>
|
|
<if test="wCol != null">w_col = #{wCol},</if>
|
|
<if test="wLayer != null">w_layer = #{wLayer},</if>
|
|
<if test="wDepth != null">w_depth = #{wDepth},</if>
|
|
<if test="isLock != null">is_lock = #{isLock},</if>
|
|
<if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="isWorking != null">is_working = #{isWorking},</if>
|
|
<if test="isEnable != null">is_enable = #{isEnable},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
|
|
<update id="updateLocationByLocationId" parameterType="AppLocation">
|
|
update app_location
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="locationType != null">location_type = #{locationType},</if>
|
|
<if test="locationStatus != null">location_status = #{locationStatus},</if>
|
|
<if test="outerId != null">outer_id = #{outerId},</if>
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
|
<if test="tunnelId != null">tunnel_id = #{tunnelId},</if>
|
|
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
|
|
<if test="wRow != null">w_row = #{wRow},</if>
|
|
<if test="wCol != null">w_col = #{wCol},</if>
|
|
<if test="wLayer != null">w_layer = #{wLayer},</if>
|
|
<if test="wDepth != null">w_depth = #{wDepth},</if>
|
|
<if test="isLock != null">is_lock = #{isLock},</if>
|
|
<if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="isWorking != null">is_working = #{isWorking},</if>
|
|
<if test="isEnable != null">is_enable = #{isEnable},</if>
|
|
</trim>
|
|
where location_id = #{locationId}
|
|
</update>
|
|
|
|
|
|
<delete id="deleteAppLocationById" parameterType="String">
|
|
delete
|
|
from app_location
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteAppLocationByIds" parameterType="Long">
|
|
delete from app_location where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectAppLocationListByIds" parameterType="String" resultMap="AppLocationResult">
|
|
<include refid="selectAppLocationVo"/>
|
|
where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
</mapper>
|