From a1e90c3da21d88f994bac9c1feb91bf40e53a44d Mon Sep 17 00:00:00 2001
From: 李宇 <986321569@qq.com>
Date: 星期三, 18 八月 2021 13:01:21 +0800
Subject: [PATCH] 耗材无供应商也显示,申购管理试剂库、申请履历、收藏不显示无效试剂和无供应商试剂 可显示无供应商的耗材

---
 src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml |   88 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 73 insertions(+), 15 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml b/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml
index d0724ec..bf8afd8 100644
--- a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryContainerDao.xml
@@ -24,20 +24,36 @@
   <update id="updateInfo" parameterType="java.util.Map">
     update sys_laboratory_container set temp=#{temp},humidity=#{humidity},voc1=#{voc1},flag=#{flag} where id=#{containerId}
   </update>
-
+  <update id="delSlcIds" parameterType="java.util.List">
+    update sys_laboratory_container set valid_flag=0, update_time=now()
+    where laboratory_id in
+    <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
+      #{item}
+    </foreach>
+  </update>
   <select id="getSysLaboratoryContainerInfoList" parameterType="java.util.Map"  resultMap="SysLaboratoryContainer" >
     select container_code,name,valid_flag,type,character_left,character_right from sys_laboratory_container where update_time >= #{startTime} and #{endTime} > update_time
   </select>
 
   <select id="getSysLaboratoryContainer" parameterType="java.lang.String"  resultMap="SysLaboratoryContainer" >
-    select su.*,ss.name as laboratoryName, ss.type as laboratoryType ,su.project project from sys_laboratory_container as su
+    select su.*,ss.name as laboratoryName, ss.type as laboratoryType ,su.project project
+    from sys_laboratory_container as su
     left join sys_laboratory as ss on su.laboratory_id = ss.id
-    where su.id = #{id} and su.valid_flag = 1
+    where su.id = #{id}
+    and su.valid_flag = 1
+    and ss.valid_flag = 1
   </select>
 
   <select id="getSysLaboratoryContainerByContainerCode" parameterType="java.lang.String" resultMap="SysLaboratoryContainer">
-    select * from sys_laboratory_container
-    where container_code = #{containerCode} and valid_flag = 1
+     SELECT
+     sys_laboratory_container.*
+     FROM
+     sys_laboratory_container
+     LEFT JOIN sys_laboratory on sys_laboratory.id = sys_laboratory_container.laboratory_id
+     WHERE
+     sys_laboratory_container.container_code = #{containerCode}
+     AND sys_laboratory_container.valid_flag = 1
+     AND sys_laboratory.valid_flag = 1
   </select>
 
   <select id="updateSysLabContainer" parameterType="java.util.Map" >
@@ -67,6 +83,12 @@
     <if test="laboratoryName != null and laboratoryName != ''">
       and ss.name like #{laboratoryName}
     </if>
+    <if test="project != null and project != ''">
+      and su.project like concat("%",#{project},"%")
+    </if>
+    <if test="controllerName != null and controllerName != ''">
+      and sc.controller_name like concat("%",#{controllerName},"%")
+    </if>
     order by ss.name ASC,sc.controller_name,su.container_code,su.name
     <if test="first != null and pageSize != null">
       limit #{first}, #{pageSize}
@@ -83,7 +105,8 @@
     bm1.meta_value containerType ,
     slc.info_code infoCode ,
     bm3.meta_value structure,
-    slc.`name` name
+    slc.`name` name,
+    slc.project
     FROM
     sys_laboratory_container slc
     LEFT JOIN base_meta bm1 ON bm1.id = slc.type
@@ -100,6 +123,12 @@
     </if>
     <if test="name != null and name != ''">
       and sl.name like concat("%",#{name},"%")
+    </if>
+    <if test="project != null and project != ''">
+      and slc.project like concat("%",#{project},"%")
+    </if>
+    <if test="controllerName != null and controllerName != ''">
+      and sc.controller_name like concat("%",#{controllerName},"%")
     </if>
     order by sl.name ASC,sc.controller_name,slc.container_code,slc.name
 
@@ -126,6 +155,12 @@
     </if>
     <if test="editId != null and editId != ''">
       and su.id != #{editId}
+    </if>
+    <if test="project != null and project != ''">
+      and su.project like concat("%",#{project},"%")
+    </if>
+    <if test="controllerName != null and controllerName != ''">
+      and sc.controller_name like concat("%",#{controllerName},"%")
     </if>
   </select>
 
@@ -189,15 +224,15 @@
 
   <select id="getContainerPersonInCharge" parameterType="java.lang.String" resultType="java.util.Map">
     SELECT slc.container_code containCode,su.name name,su.phone phone,
-CONCAT(sl.location1,"-",sl.location2) location
-
-FROM sys_laboratory_container slc
-LEFT JOIN sys_laboratory sl on sl.id = slc.laboratory_id
-LEFT JOIN sys_user su on su.department = sl.department
-LEFT JOIN base_role br on br.id = su.role_id
-WHERE slc.container_code = #{containerCode}
-and su.valid_flag =1
-and br.`name` = '实验负责人'
+    CONCAT(sl.location1,"-",sl.location2) location
+    FROM sys_laboratory_container slc
+    LEFT JOIN sys_laboratory sl on sl.id = slc.laboratory_id
+    LEFT JOIN sys_user su on su.department = sl.department
+    LEFT JOIN base_role br on br.id = su.role_id
+    WHERE slc.container_code = #{containerCode}
+    and su.valid_flag =1
+    and sl.valid_flag =1
+    and br.`name` = '实验负责人'
   </select>
 
 
@@ -211,6 +246,29 @@
   LEFT JOIN sys_laboratory sl on sl.id = slc.laboratory_id
   WHERE slc.container_code = #{containerCode}
   and slc.valid_flag = 1
+  and sl.valid_flag = 1
   </select>
 
+  <select id="selectProjectsByContainerCode" resultType="java.lang.String">
+  SELECT
+	slc.project
+    FROM
+	sys_laboratory_container AS slc
+    LEFT JOIN sys_laboratory sl ON sl.id = slc.laboratory_id
+    WHERE
+	slc.container_code = #{0}
+    AND slc.valid_flag = 1
+    AND sl.valid_flag = 1
+  </select>
+  <select id="getSysLaboratoryContainerExist" resultType="java.lang.Integer">
+    select count(1)
+    from sys_laboratory_container as su
+    where su.valid_flag = 1
+    <if test="containerCode != null and containerCode != ''">
+      and su.container_code = #{containerCode}
+    </if>
+    <if test="editId != null and editId != ''">
+      and su.id != #{editId}
+    </if>
+  </select>
 </mapper>

--
Gitblit v1.9.2