From c427ed3db05c772cec3658949e19bcf1b6c0d2a7 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 22 八月 2023 15:03:16 +0800
Subject: [PATCH] 改动5.0

---
 laboratory-server/src/main/resources/mapper/InstrumentMapper.xml                             |    3 ++-
 inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java |    8 ++++++++
 inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java      |    5 ++++-
 inspection-server/src/main/resources/mapper/InspectionMapper.xml                             |   39 +++++++++++++++++++++++++++++----------
 4 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
index f143ace..fdf32b4 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
@@ -37,7 +37,7 @@
     //鑾峰彇妫�楠岀粨璁�,妫�楠屾暟閲�
     List<Map<String, Object>> getResultNum();
 
-    //璁$畻鍘熸潗鏂欎笌鎴愬搧鐨勫悎鏍肩巼
+    //璁$畻鍘熸潗鏂欑殑鍚堟牸鐜�
     Long qualified(Integer b);
 
     //璁$畻鍘熸潗鏂欐楠屽崟鎬绘暟
@@ -45,5 +45,8 @@
 
     //璁$畻鎴愬搧妫�楠屽崟鎬绘暟
     Integer getallfin();
+
+    //璁$畻鍘熸潗鏂欏悎鏍肩巼
+    Long qualifiedfin(Integer i);
 }
 
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
index e1ab7da..79fb8cc 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
@@ -6,6 +6,7 @@
 import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo;
 import com.yuanchu.limslaboratory.service.HomeService;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
@@ -64,6 +65,7 @@
 
     //璁$畻鍘熸潗鏂欎笌鎴愬搧鐨勫悎鏍肩巼
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public StatisticsDataVo qualified() {
         StatisticsDataVo statisticsDataVo = new StatisticsDataVo();
         //鍘熸潗鏂欐楠屽崟鎬绘暟
@@ -81,8 +83,14 @@
         //鎴愬搧妫�楠屽崟鎬绘暟
         Integer allfin = inspectionMapper.getallfin();
         //鎴愬搧鍚堟牸鐜�
+        Long finished = inspectionMapper.qualifiedfin(1);
+        statisticsDataVo.setFinished(getRadio(allfin, finished));
         //鎴愬搧涓嶅悎鏍肩巼
+        Long unfinished = inspectionMapper.qualifiedfin(0);
+        statisticsDataVo.setUnfinished(getRadio(allfin, unfinished));
         //鎴愬搧鏈楠岀巼
+        Long notfinished = inspectionMapper.qualifiedfin(null);
+        statisticsDataVo.setNotfinished(getRadio(allfin, notfinished));
 
         return statisticsDataVo;
     }
diff --git a/inspection-server/src/main/resources/mapper/InspectionMapper.xml b/inspection-server/src/main/resources/mapper/InspectionMapper.xml
index e2feafa..737fb6b 100644
--- a/inspection-server/src/main/resources/mapper/InspectionMapper.xml
+++ b/inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -51,6 +51,20 @@
     </select>
 
     <!--妫�楠岀粨璁�,妫�楠屾暟閲�-->
+    <select id="qualified" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+        and type = 0
+        <if test="b!=null ">
+            and inspection_status = #{b}
+        </if>
+        <if test="b==null">
+            and inspection_status is null
+        </if>
+    </select>
+
+    <!--璁$畻鍘熸潗鏂欎笌鎴愬搧鐨勫悎鏍肩巼-->
     <select id="getResultNum" resultType="java.util.Map">
         select inspection_status result,
                count(id)         num
@@ -58,15 +72,6 @@
         where state = 1
         group by result
         order by num desc
-    </select>
-
-    <!--璁$畻鍘熸潗鏂欎笌鎴愬搧鐨勫悎鏍肩巼-->
-    <select id="qualified" resultType="java.lang.Long">
-        select count(id)
-        from lims_laboratory.inspection
-        where state = 1
-          and type = 0
-          and inspection_status = #{b}
     </select>
 
     <!--璁$畻鍘熸潗鏂欐楠屽崟鎬绘暟-->
@@ -82,6 +87,20 @@
         select count(id)
         from lims_laboratory.inspection
         where state = 1
-          and type in (1,2)
+          and type in (1, 2)
+    </select>
+
+    <!--璁$畻鍘熸潗鏂欏悎鏍肩巼-->
+    <select id="qualifiedfin" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+        and type in (1, 2)
+        <if test="i!=null ">
+            and inspection_status = #{i}
+        </if>
+        <if test="i==null">
+            and inspection_status is null
+        </if>
     </select>
 </mapper>
\ No newline at end of file
diff --git a/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml b/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
index 2bd4204..092e24c 100644
--- a/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
+++ b/laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
@@ -23,7 +23,8 @@
 
     <!--閫夋嫨璁惧-->
     <resultMap id="chooseinstumMap" type="map">
-        <id property="name" column="father_name"/>
+        <id property="id" column="cid"/>
+        <result property="name" column="father_name"/>
         <collection property="children" resultMap="chooseinstumTowMap" javaType="List"/>
     </resultMap>
     <resultMap id="chooseinstumTowMap" type="map">

--
Gitblit v1.9.3