From e29f147aab5b0b0b794d611b522b67b94423e3cf Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期四, 07 九月 2023 17:56:57 +0800
Subject: [PATCH] 修改bug

---
 inspection-server/src/main/resources/mapper/InspectionMapper.xml |  218 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 199 insertions(+), 19 deletions(-)

diff --git a/inspection-server/src/main/resources/mapper/InspectionMapper.xml b/inspection-server/src/main/resources/mapper/InspectionMapper.xml
index 8ba9919..f67ae4e 100644
--- a/inspection-server/src/main/resources/mapper/InspectionMapper.xml
+++ b/inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -1,23 +1,203 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.yuanchu.limslaboratory.mapper.InspectionMapper">
-    <select id="selectAllInspection" resultType="com.yuanchu.limslaboratory.pojo.dto.InspectionDto">
-        select i.id, type, inspection_status, qualified_state, i.create_time, user_name, inspect_start_time, inspect_end_time, u.name inspectUserName
-        from inspection i left join user u
-        on i.inspect_user_id = u.id
-        <if test="state!=null">
-            where state = #{state}
-        </if>
-        order by i.create_time desc
-        limit #{pageSize},#{countSize}
-    </select>
-    <select id="selectInspectToCount" resultType="java.lang.Integer">
-        select count(*)
-        from inspection i left join user u
-        on i.inspect_user_id = u.id
-        <if test="state!=null">
-            where state = #{state}
+    <select id="selectInspectsList" resultType="map">
+        select i.id,
+        i.code icode,
+        i.type type,
+        DATE_FORMAT(`form_time`,'%Y-%m-%d') form_time,
+        supplier,
+        im.code mcode,
+        im.name,
+        specifications,
+        unit,
+        num,
+        DATE_FORMAT(i.`create_time`,'%Y-%m-%d') as create_time,
+        u.name userName,
+        inspection_status,
+        DATE_FORMAT(i.`start_time`,'%Y-%m-%d') as start_time,
+        DATE_FORMAT(i.`end_time`,'%Y-%m-%d') as end_time
+        from lims_laboratory.inspection i
+        join lims_laboratory.user u on i.user_id = u.id
+        join lims_laboratory.inspection_material im on i.id = im.inspection_id
+        where i.state=1
+        <if test="message!=null">
+            and (i.code like concat('%', #{message}, '%')
+            or im.name like concat('%', #{message}, '%'))
         </if>
     </select>
 
-</mapper>
+    <!--璁$畻妫�楠岀殑妫�楠屽崟鏁伴噺-->
+    <select id="seleCountIns" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and inspection_status in (0, 1)
+    </select>
+
+    <!--璁$畻鏈楠岀殑妫�楠屽崟鏁伴噺-->
+    <select id="seleCountUnIns" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and inspection_status is null
+    </select>
+
+    <!--鑾峰彇妫�楠屽崟鎬绘暟-->
+    <select id="getcount" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+    </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
+        from lims_laboratory.inspection
+        where state = 1
+        group by result
+        order by num desc
+    </select>
+
+    <!--璁$畻鍘熸潗鏂欐楠屽崟鎬绘暟-->
+    <select id="getallmater" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+    </select>
+
+    <!--璁$畻鎴愬搧妫�楠屽崟鎬绘暟-->
+    <select id="getallfin" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          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>
+
+    <!--鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欐楠屾暟閲�-->
+    <select id="getMaterByDay" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+          and create_time = #{time}
+    </select>
+
+    <!--鏌ヨ璇ユ棩鏈熺殑鎴愬搧妫�楠屾暟閲�-->
+    <select id="getFinByDay" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type in (1, 2)
+          and create_time = #{time}
+    </select>
+
+    <!--鏌ヨ璇ユ棩鏈熺殑鍘熸潗鏂欏悎鏍兼暟閲�-->
+    <select id="getOkMaterByDay" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+          and inspection_status = 1
+          and end_time = #{time}
+    </select>
+
+    <!--鏌ヨ璇ユ棩鏈熺殑鎴愬搧鍚堟牸鏁伴噺-->
+    <select id="getOkFinByDay" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type in (1, 2)
+          and inspection_status = 1
+          and end_time = #{time}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勫師鏉愭枡妫�楠屾暟閲�-->
+    <select id="getMaterByMonth" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+          and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勬垚鍝佹楠屾暟閲�-->
+    <select id="getFinByMonth" resultType="java.lang.Integer">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type in (1, 2)
+          and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勫師鏉愭枡鍚堟牸鐜�-->
+    <select id="getOkMaterByMonth" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type = 0
+          and inspection_status = 1
+          and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear}
+    </select>
+
+    <!--鏌ヨ璇ユ湀鐨勬垚鍝佸悎鏍肩巼-->
+    <select id="getOkFinByMonth" resultType="java.lang.Long">
+        select count(id)
+        from lims_laboratory.inspection
+        where state = 1
+          and type in (1, 2)
+          and inspection_status = 1
+          and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear}
+    </select>
+    <select id="getInspectionMaterials" resultType="java.util.Map">
+
+    </select>
+    <select id="selectImAndUserName" resultType="java.util.Map">
+        SELECT
+            im.`code`,
+            im.`name`,
+            i.`code` iCode,
+            i.create_time iCreateTime,
+            im.specifications_id specificationsId,
+            im.specifications specifications,
+            u.`name` uName
+        FROM
+            inspection i,
+            inspection_material im,
+            `user` u
+        WHERE
+            i.id = im.inspection_id
+          AND i.user_id=u.id
+          AND i.id=#{id}
+    </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3