From 636bd027a92d4bf669410ee550a5ca6324f72c88 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 27 十月 2025 17:30:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
index 63159c1..cd59ad9 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -326,4 +326,60 @@
         t1.tempering_feed_sequence -1
         )select * from result limit 1
     </select>
+    <select id="queryTemperingGlassCountSummary" resultMap="temperingGlassCount">
+        with glass_info_temp as (
+        select engineer_id, tempering_layout_id, count(*) as total_count
+        from glass_info
+        group by engineer_id, tempering_layout_id
+        ),
+        big_details_temp as (
+        select engineer_id, tempering_layout_id, count(*) as real_count, films_id, thickness
+        from big_storage_cage_details
+        where state = 100
+        <if test="isTempering == 0">
+            and tempering_layout_id = 0
+        </if>
+        <if test="isTempering == 1">
+            and tempering_layout_id != 0
+        </if>
+
+        group by engineer_id, tempering_layout_id, films_id, thickness
+        ),
+        damage_temp as (
+        select engineer_id, tempering_layout_id, count(*) as damage_count
+        from damage
+        where type in(8,9) and STATUS = 1
+        group by engineer_id, tempering_layout_id
+        ),
+        result as (
+        select t.engineer_id,
+        t.tempering_layout_id,
+        t.films_id,
+        t.thickness,
+        total_count,
+        real_count,
+        ifnull(damage_count, 0) as damage_count,
+        case when total_count - real_count - ifnull(damage_count, 0) &lt; 0 then 0 else
+        total_count - real_count - ifnull(damage_count, 0) end as lack_count
+        from big_details_temp t
+        inner join glass_info_temp t1 on t.engineer_id = t1.engineer_id and
+        t.tempering_layout_id = t1.tempering_layout_id
+        left join damage_temp t2
+        on t.engineer_id = t2.engineer_id and t.tempering_layout_id = t2.tempering_layout_id
+        ),
+        -- 浜屾姹囨�诲眰
+        secondary_summary as (
+        select
+        engineer_id,
+        films_id,
+        thickness,
+        count(distinct tempering_layout_id) as total_count, -- 璁$畻totalCount鐨勭疮璁℃暟锛堝幓閲嶈鏁帮級
+        sum(total_count) as real_count -- 璁$畻realCount鐨勬�诲拰
+        from result
+        group by engineer_id, films_id, thickness
+        )
+        select *
+        from secondary_summary
+        order by engineer_id, films_id, thickness
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0