严智鑫
2024-03-26 babe6c13857d0f21167cf39812237d505ef0e849
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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.example.mess.mapper.BigStorageCageMapper">
    <!-- <resultMap id="BigStorageCage" type="com.example.mes.entity.BigStorageCage" >
        <id column="id" property="id"/>
        <result column="device_id" property="deviceId"/>
        <result column="slot" property="slot"/>
        <result column="enable_state" property="enableState"/>
        <result column="remain_width" property="remainWidth"/>
 
        <result column="glass_id" property="bigStorageCageDetail.glassId"/>
        <result column="sequence" property="bigStorageCageDetail.sequence"/>
        <result column="flow_card_id" property="bigStorageCageDetail.flowCardId"/>
        <result column="glass_type" property="bigStorageCageDetail.glassType"/>
        <result column="width" property="bigStorageCageDetail.width"/>
        <result column="height" property="bigStorageCageDetail.height"/>
        <result column="thickness" property="bigStorageCageDetail.thickness"/>
        <result column="tempering_layout_id" property="bigStorageCageDetail.temperingLayoutId"/>
        <result column="tempering_feed_sequence" property="bigStorageCageDetail.temperingFeedSequence"/>
        <result column="state" property="bigStorageCageDetail.state"/>
        <result column="gap" property="bigStorageCageDetail.gap"/>
    </resultMap>
 
    <resultMap id="BigStorageCageDetails" type="com.example.mes.entity.BigStorageCageDetails" >
        <id column="id" property="id"/>
        <result column="device_id" property="deviceId"/>
        <result column="slot" property="slot"/>
        <result column="glass_id" property="glassId"/>
        <result column="sequence" property="sequence"/>
        <result column="flow_card_id" property="flowCardId"/>
        <result column="glass_type" property="glassType"/>
        <result column="width" property="width"/>
        <result column="height" property="height"/>
        <result column="thickness" property="thickness"/>
        <result column="tempering_layout_id" property="temperingLayoutId"/>
        <result column="tempering_feed_sequence" property="temperingFeedSequence"/>
        <result column="state" property="state"/>
        <result column="gap" property="gap"/>
    </resultMap>
 
    <select id="SelectTemperingFeedSlot" resultMap="BigStorageCageDetails">
        select * from big_storage_cage bsc inner join big_storage_cage_details as bscd on bsc.slot=bscd.slot
        <where>
            and bscd.id=(select id from big_storage_cage_details where slot=bscd.slot 
            and tempering_feed_sequence=#{bigStorageCageDetails.temperingFeedSequence}-1
            and bsc.remain_width>#{bigStorageCageDetails.width}
            ORDER BY sequence desc LIMIT 1)
        </where>
    </select>
 
    <select id="SelectStorageCageSummary" resultMap="BigStorageCageDetails">
        select min(case when bsc.remain_width=5000 then bsc.id else null end ) as id,bsc.device_id,
        min(case when bsc.remain_width=5000 then bsc.slot else null end ) as slot,
        count(distinct bscd.tempering_layout_id) as tempering_layout_ids
        from big_storage_cage bsc left join big_storage_cage_details bscd on bsc.slot=bscd.slot
        <where>
            and bsc.enable_state=0
        </where>
        group by bsc.device_id
        order by tempering_layout_ids,bsc.device_id limit 1
    </select> -->
 
</mapper>