hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -6,14 +6,18 @@
        <result column="engineer_id" property="engineerId"/>
        <result column="tempering_layout_id" property="temperingLayoutId"/>
        <result column="count" property="count"/>
        <result column="slot_count" property="slotCount"/>
    </resultMap>
    <!--    <select id="listAllTemperingCount" resultMap="temperingLayoutDTO">-->
    <!--        select tempering_layout_id,-->
    <!--               count(tempering_layout_id) as count-->
    <!--        from big_storage_cage_details-->
    <!--        where state = 100-->
    <!--        group by tempering_layout_id-->
    <!--    </select>-->
    <resultMap id="slotSequenceDTO" type="com.mes.bigstorage.entity.dto.SlotSequenceDTO">
        <result column="engineer_id" property="engineerId"/>
        <result column="tempering_layout_id" property="temperingLayoutId"/>
        <result column="slot" property="slot"/>
        <result column="max_sequence" property="maxSequence"/>
        <result column="min_sequence" property="minSequence"/>
        <result column="remain_width" property="remainWidth"/>
    </resultMap>
    <select id="temperingIsAll" resultMap="temperingLayoutDTO">
        SELECT T.ENGINEER_ID,
               T.TEMPERING_LAYOUT_ID,
@@ -41,4 +45,32 @@
            LIMIT 1
    </select>
    <select id="queryTemperingOccupySlot" resultMap="temperingLayoutDTO">
        SELECT TEMPERING_LAYOUT_ID,
               COUNT(DISTINCT SLOT) as SLOT_COUNT
        FROM BIG_STORAGE_CAGE_DETAILS
        WHERE STATE = 100
        GROUP BY ENGINEER_ID,
                 TEMPERING_LAYOUT_ID
        HAVING SLOT_COUNT &gt;= #{count} LIMIT 1
    </select>
    <select id="queryGlassMaxAndMin" resultMap="slotSequenceDTO">
        SELECT T.*,
               T1.REMAIN_WIDTH
        FROM (
                 SELECT ENGINEER_ID,
                        TEMPERING_LAYOUT_ID,
                        SLOT,
                        MAX(TEMPERING_FEED_SEQUENCE) AS MAX_SEQUENCE,
                        MIN(TEMPERING_FEED_SEQUENCE) AS MIN_SEQUENCE
                 FROM BIG_STORAGE_CAGE_DETAILS
                 WHERE ENGINEER_ID = #{engineerId}
                   AND TEMPERING_LAYOUT_ID = #{temperingLayoutId}
                 GROUP BY ENGINEER_ID,
                          TEMPERING_LAYOUT_ID,
                          SLOT
             ) T
                 INNER JOIN BIG_STORAGE_CAGE T1 ON T.SLOT = T1.SLOT
        ORDER BY T.MAX_SEQUENCE DESC
    </select>
</mapper>