From 13812c31cf964e42e81c776207e131446efe8cfe Mon Sep 17 00:00:00 2001
From: gdg <764716047@qq.com>
Date: 星期二, 02 二月 2021 18:05:00 +0800
Subject: [PATCH] update

---
 src/main/java/com/nanometer/smartlab/dao/SysLaboratoryDao.xml |   47 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryDao.xml b/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryDao.xml
index 4405799..4e3e7c7 100644
--- a/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryDao.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/SysLaboratoryDao.xml
@@ -31,6 +31,9 @@
     <if test="department != null and department != ''">
       and su.department = #{department}
     </if>
+    <if test="project != null and project != ''">
+      and su.project like concat("%",#{project},"%")
+    </if>
   </sql>
 
   <select id="getSysLaboratory" parameterType="java.lang.String"  resultMap="SysLaboratory" >
@@ -48,6 +51,33 @@
     </if>
   </select>
 
+  <select id="exportLabList" parameterType="java.util.Map" resultType="java.util.Map">
+    SELECT bm1.meta_value type ,sl.name,sl.info_code infoCode,sl.bar_code barCode,
+    CASE
+    WHEN (ISNULL(location1)=1) || (LENGTH(trim(location1))=0)
+    THEN
+    CONCAT(location1,location2)
+    ELSE
+    CONCAT(location1,'-',location2)
+    END
+    location,
+    bm2.meta_value department,
+    sl.project
+    from sys_laboratory as sl
+    LEFT JOIN base_meta bm1 on bm1.id = sl.type
+    left JOIN base_meta bm2 on bm2.id = sl.department
+    where sl .valid_flag = 1
+    <if test="name != null and name != ''">
+      and sl.name like concat("%",#{name},"%")
+    </if>
+    <if test="type != null and type != ''">
+      and sl.type = #{type};
+    </if>
+    <if test="project != null and project != ''">
+      and sl.project like concat("%",#{project},"%")
+    </if>
+  </select>
+
   <select id="getSysLaboratoryTotalCount" parameterType="java.util.Map" resultType="int">
     select count(1) from sys_laboratory as su
     where su.valid_flag = 1
@@ -61,13 +91,13 @@
   </select>
 
   <insert id="insertSysLaboratory" parameterType="com.nanometer.smartlab.entity.SysLaboratory">
-    insert into sys_laboratory(id, type, name, info_code, bar_code, location1, location2, valid_flag,department, create_time, update_time)
-    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1,#{department}, now(), now())
+    insert into sys_laboratory(id, type, name, info_code, bar_code, location1, location2, valid_flag,department, create_time, update_time,project)
+    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1,#{department}, now(), now(),#{project})
   </insert>
 
   <update id="updateSysLaboratory" parameterType="com.nanometer.smartlab.entity.SysLaboratory">
     update sys_laboratory set type=#{type}, name=#{name}, info_code=#{infoCode}, bar_code=#{barCode}, location1=#{location1}, location2=#{location2},department=#{department},
-    update_time=now()
+    update_time=now(),project = #{project}
     where id=#{id}
   </update>
 
@@ -89,7 +119,16 @@
     where bar_code = #{barCode}
     and valid_flag=1
   </select>
-
+  <select id="getLaboratoryByProject" resultType="com.nanometer.smartlab.entity.dto.LaboratoryVo$Laboratory">
+    SELECT
+    CONCAT('楼号:',sl.location1,'-地址号:',sl.location2) as address,
+    bm.meta_value as department
+    FROM
+	sys_laboratory as sl
+    LEFT JOIN base_meta bm on bm.id = sl.department
+    WHERE
+	sl.project LIKE CONCAT('%',#{project},'%')
+  </select>
   <update id="updateLabExport" parameterType="com.nanometer.smartlab.entity.SysLaboratory">
     update sys_laboratory set
     type=#{type},

--
Gitblit v1.9.2