From c9da1b0da1178911e383ddcaebecd1e088fa6004 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期二, 05 九月 2023 16:37:07 +0800
Subject: [PATCH] 修改bug

---
 laboratory-server/src/main/resources/mapper/InstrumentMapper.xml |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml b/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
index 092e24c..e2702b3 100644
--- a/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
+++ b/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
@@ -37,12 +37,52 @@
         <result property="name" column="name"/>
     </resultMap>
     <select id="chooseinstum" resultMap="chooseinstumMap">
-        select c.id cid,
-            instrument.id,
-               father_name ,
-               son_name ,
+        select c.id           cid,
+               instrument.id,
+               father_name,
+               son_name,
                equipment_name name
         from lims_laboratory.instrument
                  left join lims_laboratory.classify c on c.id = instrument.classify_id
+        where conditions in (1, 5)
     </select>
+    <select id="getInstrument" resultMap="treeMapClassAndInstrument">
+        SELECT
+            *
+        FROM
+            classify f,(
+            SELECT
+                cl.id cId,
+                cl.son_name cSonName,
+                cl.father_name cFatherName,
+                i.id iId,
+                equipment_name equipmentName
+            FROM
+                classify cl,
+                instrument i
+            WHERE
+                i.classify_id = cl.id
+              AND i.state = 1
+              AND conditions = 5
+        ) s
+        WHERE
+            f.father_name = s.cFatherName
+          AND f.son_name IS NULL
+    </select>
+    <select id="getInstrumentAndUser" resultType="java.util.Map">
+
+    </select>
+
+    <resultMap id="treeMapClassAndInstrument" type="com.yuanchu.limslaboratory.pojo.ClassAndInsTree" >
+        <result property="fatherId" column="id"/>
+        <result property="fatherName" column="father_name"/>
+        <collection property="childrenList" ofType="classAndIns">
+            <result property="sonId" column="cId"/>
+            <result property="sonName" column="cSonName"/>
+            <collection property="childrenList" ofType="ins">
+                <result property="insId" column="iId"/>
+                <result property="name" column="equipmentName"/>
+            </collection>
+        </collection>
+    </resultMap>
 </mapper>

--
Gitblit v1.9.3