From 5ac3cab3bc6a877c59719cc4b4de758444ea4dd8 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期一, 07 四月 2025 15:12:12 +0800
Subject: [PATCH] Merge branch 'radio_frequency' of http://114.132.189.42:9002/r/lims-ruoyi-after into radio_frequency

---
 basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml        |   64 ++++++++++++++++++++++---------
 basic-server/src/main/java/com/ruoyi/basic/excel/MultiSheetImportListener.java |    6 --
 2 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/basic-server/src/main/java/com/ruoyi/basic/excel/MultiSheetImportListener.java b/basic-server/src/main/java/com/ruoyi/basic/excel/MultiSheetImportListener.java
index 281061c..298b820 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/excel/MultiSheetImportListener.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/excel/MultiSheetImportListener.java
@@ -78,8 +78,7 @@
         // 鏌ヨ鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿悓璁板綍
         LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class)
                 .eq(StructureItemParameter::getInspectionItem, data.getInspectionItem())
-                .eq(StructureItemParameter::getSample, data.getSample())
-                .last("limit 1");
+                .eq(StructureItemParameter::getSample, data.getSample());
 
         // 鍒ゆ柇鏄惁鏈夋楠岄」绫诲瀷
         if (ObjectUtils.isNotEmpty(data.getInspectionItemClass())) {
@@ -169,9 +168,6 @@
         if (data.getManDay() == null) {
             data.setManDay(null);
         }
-
-        // 璁剧疆褰撳墠Sheet鍚嶄负鍒嗙被鏍囪瘑
-        data.setInspectionItemClass(currentSheetName);
 
         // 娣诲姞鍒扮紦瀛樺垪琛�
         cachedList.add(data);
diff --git a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
index c8c4ea8..ae4ba83 100644
--- a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
+++ b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -43,7 +43,25 @@
         where sample like concat('%', #{sample}, '%')
     </delete>
     <select id="selectItemParameterList" resultType="com.ruoyi.basic.pojo.StructureItemParameter">
-        select * from (select A.id,
+        WITH temp_sample AS (
+        SELECT
+        *,
+        CASE
+        WHEN INSTR(sample, ',') > 0 THEN
+        SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
+        WHEN sample = '[""]' THEN
+        NULL
+        WHEN sample = '[]' THEN
+        NULL
+        ELSE
+        TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
+        END AS samples
+        FROM
+        structure_item_parameter
+        ),
+        temp_join AS (
+        SELECT DISTINCT
+        A.id,
         inspection_item,
         inspection_item_en,
         inspection_item_subclass,
@@ -75,31 +93,39 @@
         code,
         radius_list,
         rates
-        from (select *,
-        CASE
-        WHEN INSTR(sample, ',') > 0 THEN
-        SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
-        when sample = '[""]' then null
-        when sample = '[]' then null
-        ELSE
-        TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
-        END AS samples
-        from structure_item_parameter) A
-        left join structure_test_object sto on samples = specimen_name
+        FROM
+        temp_sample A
+        LEFT JOIN
+        structure_test_object sto ON A.samples = sto.specimen_name
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             ${ew.customSqlSegment}
-        </if>)B
-        order by CASE
+        </if>
+        )
+        SELECT
+        *
+        FROM
+        temp_join
+        ORDER BY
+        -- 澶勭悊 code 瀛楁鐨勬帓搴�
+        CASE
         WHEN code IS NULL THEN 1
         ELSE 0
         END,
         CAST(code AS UNSIGNED),
-        case when man_hour_group is NULL then 1
-        when man_hour_group ='' then 1 else 0 end,
+        -- 澶勭悊 man_hour_group 瀛楁鐨勬帓搴�
         CASE
-        WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- 濡傛灉浠ユ暟瀛楀紑澶达紝鍒欐寜鐓ф暟瀛楀ぇ灏忔帓搴�
-        WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
-        ,id asc
+        WHEN man_hour_group IS NULL OR man_hour_group = '' THEN 1
+        ELSE 0
+        END,
+        CASE
+        WHEN man_hour_group REGEXP '^[0-9]' THEN
+        CAST(man_hour_group AS UNSIGNED)
+        WHEN man_hour_group REGEXP '[0-9]+' THEN
+        CAST(SUBSTRING(man_hour_group, 2) AS UNSIGNED)
+        ELSE
+        NULL
+        END,
+        id ASC
     </select>
 
     <resultMap id="getInsProductions" type="map">

--
Gitblit v1.9.3