ZengTao
2025-03-07 5ec61cdaa2c1ab4dd1d58bd94afb49343332e78f
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageMapper.xml
@@ -1,6 +1,15 @@
<?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.bigstorage.mapper.BigStorageCageMapper">
    <resultMap id="downStorageCageDetails" type="com.mes.bigstorage.entity.dto.BigStorageSummaryDTO">
        <result column="engineer_id" property="engineerId"/>
        <result column="countTemp" property="countTemp"/>
        <result column="countGlass" property="countGlass"/>
        <result column="area" property="area"/>
        <result column="fullTemp" property="fullTemp"/>
        <result column="countSlot" property="countSlot"/>
        <result column="percent" property="percent"/>
    </resultMap>
    <select id="queryFreeDeviceByUsed" resultType="java.lang.Integer">
@@ -16,6 +25,48 @@
                 COUNT(DISTINCT T1.SLOT)
    </select>
    <select id="selectBigStorageSummary" resultType="com.mes.bigstorage.entity.dto.BigStorageSummaryDTO">
        SELECT
            engineer_id as engineerId,
            count( tempering_layout_id ) AS countTemp,
            sum( countGlass ) AS countGlass,
            round( sum( area ), 2 ) as area,
            sum( fullTemp ) AS fullTemp,
            sum( countSlot ) AS countSlot,
            sum( countGlass )/ sum( countGlass1 )* 100 AS percent,
            thickness
        FROM
            (
                SELECT
                    bscd.engineer_id,
                    bscd.tempering_layout_id,
                    count(*) AS countGlass,
                    sum( bscd.width * bscd.height / 1000000 ) AS area,
                    IF
                        ( gi.countGlass1 = count(*), 1, 0 ) AS fullTemp,
                    count( DISTINCT bscd.slot ) AS countSlot,
                    countGlass1,
                    gi.thickness
                FROM
                    big_storage_cage_details bscd
                        INNER JOIN ( SELECT engineer_id, tempering_layout_id, count(*) AS countGlass1, thickness FROM glass_info GROUP BY engineer_id, tempering_layout_id ) gi ON bscd.engineer_id = gi.engineer_id
                        AND bscd.tempering_layout_id = gi.tempering_layout_id
                WHERE
                    bscd.state = 100
                GROUP BY
                    bscd.engineer_id,
                    bscd.tempering_layout_id
            ) AS cageSummary
        GROUP BY
            engineer_id
        ORDER BY
            percent DESC,
            thickness DESC,
            countSlot DESC
    </select>
    <!--    <select id="queryFreeDeviceByNotUsed" resultType="java.lang.Integer">-->
    <!--        SELECT T.DEVICE_ID-->
    <!--        FROM BIG_STORAGE_CAGE T-->