From 68ff33beff11310e830b0615b5a81f83fad0f683 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期日, 08 十一月 2026 23:33:14 +0800
Subject: [PATCH] ai优化

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queuesequence/QueueSequenceMapper.java |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queuesequence/QueueSequenceMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queuesequence/QueueSequenceMapper.java
index 9ccf2a5..24bf8b8 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queuesequence/QueueSequenceMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/queuesequence/QueueSequenceMapper.java
@@ -58,9 +58,48 @@
     @Update("update lihu.queue_sequence set queue_vip_no = queue_vip_no + 1 where check_type=#{checkType} and time_slot=#{timeslot} and queue_vip_no=#{curQueueVipNo} and queue_vip_no < queue_vip_full; ")
     Integer updateGivenCheckTypeTimeslotVipSeqNo(@Param("checkType") Integer checkType, @Param("timeslot") Integer timeslot, @Param("curQueueVipNo") Integer curQueueVipNo);
 
-    @Update("UPDATE lihu.queue_sequence SET queue_no=queue_set,queue_vip_no=queue_vip_set WHERE deleted=0; ")
+    @Update("UPDATE lihu.queue_sequence SET queue_no=COALESCE(queue_set, 0), queue_vip_no=COALESCE(queue_vip_set, 0) WHERE deleted=0; ")
     Integer initNumber();
 
+    // =========================================================================
+    // 銆愭湰闇�姹傘�戞寜鏃舵棰勭害涓夌骇鍙栧彿锛氭湰娈垫櫘閫氬彿 鈫� 鏈棰勭暀鍙� 鈫� 鎬婚鐣欐睜(time_slot=0)
+    //
+    // 鍙锋绾﹀畾锛堟櫘閫氬湪鍓嶃�侀鐣欑揣璺熷叾鍚庛�佷笅涓�娈佃捣鐐� = 涓婁竴娈� queue_vip_full锛夛細
+    //   鏅�氬彿: queue_set+1        鈥� queue_full
+    //   棰勭暀鍙�: queue_full+1       鈥� queue_vip_full
+    //   鎬婚鐣欐睜: 鍙锋鏀惧湪褰撳ぉ鎵�鏈夋椂娈典箣鍚庯紝涓�**涓嶈涓婇檺**
+    // =========================================================================
+
+    /** 鍙栨煇鏃舵鏁磋锛堟嬁鍒� queue_set/queue_full/queue_vip_set/queue_vip_full 杈圭晫锛� */
+    @Select("select * from lihu.queue_sequence where check_type=#{checkType} and time_slot=#{timeslot} and deleted=0 limit 1")
+    QueueSequenceDO selectSegByCheckTypeAndTimeSlot(@Param("checkType") Integer checkType,
+                                                    @Param("timeslot") Integer timeslot);
+
+    /** 鍙栬妫�鏌ョ被鍨嬬殑銆屾�婚鐣欐睜銆嶈锛坱ime_slot = 0锛� */
+    @Select("select * from lihu.queue_sequence where check_type=#{checkType} and time_slot=0 and deleted=0 limit 1")
+    QueueSequenceDO selectTotalPool(@Param("checkType") Integer checkType);
+
+    /** 璇ユ鏌ョ被鍨嬪綋澶╂墍鏈夋椂娈电殑**鏈�澶ч鐣欏彿涓婇檺**锛堢敤浜庣粰鎬婚鐣欐睜瀹氫綅鍙锋璧风偣锛� */
+    @Select("select COALESCE(MAX(queue_vip_full), 0) from lihu.queue_sequence "
+            + " where check_type=#{checkType} and time_slot<>0 and deleted=0")
+    Integer selectMaxVipFullOfCheckType(@Param("checkType") Integer checkType);
+
+    /**
+     * 鎬婚鐣欐睜鍙戝彿锛�**涓嶈涓婇檺**銆�
+     * <p>
+     * 璇箟涓庡叾瀹冨彿姹犱繚鎸佷竴鑷达紙{@code queue_vip_full} = 褰撳墠鏈�澶у彲鍙戝彿锛夛細
+     * 鍙� +1 鐨勫悓鏃舵妸 {@code queue_vip_full} 椤朵笂鏉ワ紝鍥犳姘歌繙涓嶄細鍑虹幇"鎬绘睜宸叉弧銆佺涓嶄笂"銆�
+     */
+    @Update("update lihu.queue_sequence "
+            + " set queue_vip_no = queue_vip_no + 1, "
+            + "     queue_vip_full = GREATEST(queue_vip_full, queue_vip_no + 1) "
+            + " where check_type=#{checkType} and time_slot=0 and deleted=0")
+    Integer advanceTotalPoolVipNo(@Param("checkType") Integer checkType);
+
+    /** 璇诲洖鎬婚鐣欐睜褰撳墠宸插彂鍙凤紙蹇呴』涓庢帹杩涘湪鍚屼竴浜嬪姟鍐咃級 */
+    @Select("select queue_vip_no from lihu.queue_sequence where check_type=#{checkType} and time_slot=0 and deleted=0")
+    Integer selectTotalPoolVipNo(@Param("checkType") Integer checkType);
+
     /**
      * 銆愪慨澶嶃�屾椂娈典笉鍏�/宸叉弧瀵艰嚧娌℃硶绛惧埌銆嶃�戝垽鏂寚瀹� (妫�鏌ョ被鍨�, 鏃舵) 鏄惁**杩樻湁鍙彇鍙�**銆�
      * <p>

--
Gitblit v1.9.3