From f31ae33e37895b9517ee6ace6bd703f4bbb47e81 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期日, 23 六月 2024 23:44:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml b/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
index 44a1f3f..02911c3 100644
--- a/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
+++ b/cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -4,7 +4,9 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yuanchu.mom.mapper.StructureItemParameterMapper">
     <delete id="removeNoSample">
-        delete from structure_item_parameter where sample like concat('%',#{sample},'%')
+        delete
+        from structure_item_parameter
+        where sample like concat('%', #{sample}, '%')
     </delete>
     <select id="selectItemParameterList" resultType="com.yuanchu.mom.pojo.StructureItemParameter">
         select * from (select A.id,
@@ -54,19 +56,37 @@
         WHEN code IS NULL THEN 1
         ELSE 0
         END,
-        CAST(code AS UNSIGNED) asc
+        CAST(code AS UNSIGNED),
+        case when man_hour_group is NULL then 1
+        when 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) END -- 鎻愬彇瀛楁瘝鍚庨潰鐨勬暟瀛楅儴鍒�
+        ,id asc
     </select>
 
     <resultMap id="getInsProductions" type="map">
-        <result property="name" column="inspection_item"/>
+        <result property="name" column="sample"/>
         <collection property="children" resultMap="seProInsListByIdmaps" javaType="List"/>
     </resultMap>
     <resultMap id="seProInsListByIdmaps" type="map">
+        <result property="name" column="inspection_item"/>
+        <collection property="children" resultMap="seProInsListByIdmaps2" javaType="List"/>
+    </resultMap>
+    <resultMap id="seProInsListByIdmaps2" type="map">
         <id property="id" column="id"/>
         <result property="name" column="subclass"/>
     </resultMap>
     <select id="getInsProduction" resultMap="getInsProductions">
-        select id,
+        select distinct id,
+               CASE
+                   WHEN INSTR(sample, ',') > 0 THEN
+                       SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
+                   when sample = '[""]' then '*'
+                   ELSE
+                       TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
+                   END
+                as sample,
                inspection_item,
                case
                    when inspection_item_subclass is null then inspection_item

--
Gitblit v1.9.3