From 62cd9d30a8995f11be78aeb49815e7f7d4a11506 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期二, 13 十月 2026 17:45:18 +0800
Subject: [PATCH] 设备模块后端调整:档案修订保存时自动同步生成本年度校准、核查、保养计划明细(校准计划时间取有效期前一个月,核查、保养取下次日期前一个月);设备新增保养、核查日期与周期字段;设备树查询改为全部/设备/计量器具分类;新增检测员角色人员查询接口;导入模板移除所属部门列

---
 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