<?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.mes.edgstoragecage.mapper.EdgStorageCageMapper">
|
|
<resultMap id="baseMap" type="com.mes.edgstoragecage.entity.EdgStorageCage">
|
<id column="id" property="id" jdbcType="INTEGER"/>
|
<result column="device_id" property="deviceId" jdbcType="INTEGER"/>
|
<result column="slot" property="slot" jdbcType="INTEGER"/>
|
<result column="enable_state" property="enableState" jdbcType="INTEGER"/>
|
<result column="remain_width" property="remainWidth" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<update id="resetSlotRemainWidth">
|
<foreach collection="list" item="item" separator=";" open="begin" close=";end;">
|
update edg_storage_cage set remain_width = #{item.remainWidth} where
|
device_id = #{item.deviceId} and slot = #{item.slot}
|
</foreach>
|
</update>
|
|
<select id="getEdgStorageCageBySize" resultMap="baseMap">
|
select t.*
|
from edg_storage_cage t
|
left join edg_storage_cage_details t1 on t.slot = t1.slot
|
where t.device_id = #{deviceId}
|
and t1.state = 100
|
and t.remain_width >= GREATEST(#{width}, #{height})
|
and t1.width = #{width}
|
and t1.height = #{height}
|
and t.enable_state = 1
|
order by abs(t.slot - #{slot})
|
limit 1
|
</select>
|
</mapper>
|