From 330f90fe25f054ddcdec4c3ce037ea1ea851be72 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期四, 15 十月 2026 11:42:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 cnas-device/src/main/resources/mapper/DeviceMapper.xml |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/cnas-device/src/main/resources/mapper/DeviceMapper.xml b/cnas-device/src/main/resources/mapper/DeviceMapper.xml
index 5460a17..8009a5a 100644
--- a/cnas-device/src/main/resources/mapper/DeviceMapper.xml
+++ b/cnas-device/src/main/resources/mapper/DeviceMapper.xml
@@ -130,13 +130,7 @@
     <resultMap id="treeDeviceDto" type="map">
         <result property="label" column="laboratory_name"/>
         <result property="value" column="value" />
-        <collection property="children" resultMap="storagePointMap" javaType="List"/>
-    </resultMap>
-
-    <resultMap id="storagePointMap" type="map">
-        <result property="value" column="value"/>
-        <result property="label" column="storage_point"/>
-        <collection property="children" resultMap="deviceNameMap" javaType="List"/>
+        <collection property="children" resultMap="deviceNameMap" javaType="List" notNullColumn="id"/>
     </resultMap>
 
     <resultMap id="deviceNameMap" type="map">
@@ -144,24 +138,32 @@
         <result property="label" column="device_name"/>
         <result property="activationDate" column="activation_date"/>
         <result property="managementNumber" column="management_number"/>
+        <result property="storagePoint" column="storage_point"/>
     </resultMap>
 
     <select id="treeDevice" resultMap="treeDeviceDto">
         select
+        c.laboratory_name,
         d.id,
-        case when sd.dept_name is null || sd.dept_name ='' then '鍏朵粬' else sd.dept_name end as laboratory_name,
-        case when d.storage_point is null || d.storage_point ='' then '鍏朵粬' else d.storage_point end as storage_point,
         d.device_name,
         d.management_number,
-        null as value,
-        d.activation_date
-        from device d
-        LEFT JOIN sys_dept sd ON sd.dept_id = d.subordinate_departments_id AND sd.del_flag = '0'
+        d.storage_point,
+        d.activation_date,
+        null as value
+        from (
+            select 1 as sort_no, '鍏ㄩ儴' as laboratory_name
+            union all
+            select 2 as sort_no, '璁惧' as laboratory_name
+            union all
+            select 3 as sort_no, '璁¢噺鍣ㄥ叿' as laboratory_name
+        ) c
+        left join device d on c.sort_no = 1 or d.large_category = c.laboratory_name
         <where>
             <if test="deviceName!=null and deviceName!=''">
-                and device_name like concat('%',#{deviceName},'%')
+                and d.device_name like concat('%',#{deviceName},'%')
             </if>
         </where>
+        order by c.sort_no, d.id
     </select>
 
     <select id="selectDeviceByCode" resultType="com.ruoyi.device.dto.DeviceDto">

--
Gitblit v1.9.3