From 3c7d672fb7d6c34742fb7da6f66616ccf3be2c9a Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期五, 08 十一月 2024 14:50:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml
new file mode 100644
index 0000000..3ef3805
--- /dev/null
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml
@@ -0,0 +1,58 @@
+<?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.EdgStorageCageDetailsMapper">
+
+    <resultMap id="baseMap" type="com.mes.edgstoragecage.entity.EdgStorageCageDetails">
+        <id column="id" property="id"/>
+        <result column="engineer_id" property="engineerId"/>
+        <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="edg_width" property="edgWidth"/>
+        <result column="edg_height" property="edgHeight"/>
+        <result column="tempering_layout_id" property="temperingLayoutId"/>
+        <result column="tempering_feed_sequence" property="temperingFeedSequence"/>
+        <result column="pattern_sequence" property="patternSequence"/>
+        <result column="state" property="state"/>
+        <result column="gap" property="gap"/>
+        <result column="glass_count" property="count"/>
+    </resultMap>
+
+    <select id="queryEdgStorageDetailsBySize" resultMap="baseMap">
+        with min_id_temp as (
+        select slot, min(id) as id, count(*) as glass_count
+        from edg_storage_cage_details
+        where state = 100
+        group by slot
+        ),
+        size_max_temp as (
+        select width, height, count(*) as total_count
+        from edg_storage_cage_details t
+        inner join min_id_temp t1 on t.id = t1.id
+        group by width, height
+        ),
+        slot_temp as (
+        select t.*, t1.glass_count
+        from edg_storage_cage_details t
+        inner join min_id_temp t1 on t.id = t1.id
+        inner join size_max_temp t2 on t.width = t2.width and t.height = t2.height
+        <where>
+            <if test="width != 0">
+                and t.width = #{width}
+            </if>
+            <if test="height != 0">
+                and t.height = #{height}
+            </if>
+        </where>
+        order by total_count desc, glass_count, abs(t.slot - 10)
+        )
+        select *
+        from slot_temp limit 1
+    </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0