ZengTao
2025-03-28 f68d3c71819feb59e7a227a5d992b059b900916c
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
<?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>
 
    <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>