From c87738a78f57e6f68a0111d68ef3748b29dc1eda Mon Sep 17 00:00:00 2001
From: 李宇 <986321569@qq.com>
Date: 星期三, 23 六月 2021 12:21:59 +0800
Subject: [PATCH] 修改试剂排序

---
 src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml b/src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml
index 968ce43..3192bd6 100644
--- a/src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml
@@ -12,6 +12,28 @@
     <result property="validFlag" column="valid_flag" typeHandler="com.nanometer.smartlab.entity.handler.ValidFlagHandler"></result>
     <result property="createTime" column="create_time"></result>
     <result property="updateTime" column="update_time"></result>
+    <result property="department" column="department"></result>
+  </resultMap>
+
+  <resultMap id="SysWarehouseDto" type="com.nanometer.smartlab.entity.dto.SysWarehouseDto">
+    <id property="id" column="id"/>
+    <result property="type" column="type"/>
+    <result property="name" column="name"/>
+    <result property="infoCode" column="info_code"/>
+    <result property="barCode" column="bar_code"/>
+    <result property="location1" column="location1"/>
+    <result property="location2" column="location2"/>
+    <collection property="sysWarehouseContainer" ofType="com.nanometer.smartlab.entity.dto.SysWarehouseContainerDto" fetchType="lazy">
+      <id property="id" column="wc_id"/>
+      <result property="type" column="wc_type"/>
+      <result property="name" column="wc_name"/>
+      <result property="containerCode" column="container_code"/>
+      <result property="infoCode" column="info_code"/>
+      <result property="structure" column="structure"/>
+      <result property="warehouseContainerName" column="wc_name"/>
+      <result property="warehouseContainerType" column="wc_type"/>
+      <result property="controllerCode" column="controller_code"/>
+    </collection>
   </resultMap>
 
   <sql id="queryWhereSql">
@@ -57,13 +79,13 @@
   </select>
 
   <insert id="insertSysWarehouse" parameterType="com.nanometer.smartlab.entity.SysWarehouse">
-    insert into sys_warehouse(id, type, name, info_code, bar_code, location1, location2, valid_flag, create_time, update_time)
-    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1, now(), now())
+    insert into sys_warehouse(id, type, name, info_code, bar_code, location1, location2, valid_flag, create_time, update_time,department)
+    values (#{id}, #{type}, #{name}, #{infoCode}, #{barCode}, #{location1}, #{location2}, 1, now(), now(),#{department})
   </insert>
 
   <update id="updateSysWarehouse" parameterType="com.nanometer.smartlab.entity.SysWarehouse">
     update sys_warehouse set type=#{type}, name=#{name}, info_code=#{infoCode}, bar_code=#{barCode}, location1=#{location1}, location2=#{location2},
-    update_time=now()
+    update_time=now(),department=#{department}
     where id=#{id}
   </update>
 
@@ -79,4 +101,31 @@
     select * from sys_warehouse
     where bar_code = #{barCode}
   </select>
+  
+  
+  <select id="selectWarehouse" resultMap="SysWarehouseDto">
+ SELECT
+	sw.id,
+	bm1.meta_value type,
+	sw.`name` name ,
+	sw.info_code,
+	sw.bar_code,
+	sw.location1,
+	sw.location2,
+	swc.id wc_id,
+	bm2.meta_value wc_type,
+	swc.`name` wc_name,
+	swc.info_code ,
+	swc.controller_code,
+	bm3.meta_value structure,
+	swc.container_code
+FROM
+	`sys_warehouse` sw
+	LEFT JOIN base_meta bm1 ON bm1.id = sw.type
+	LEFT JOIN sys_warehouse_container swc ON swc.warehouse_id = sw.id
+	LEFT JOIN base_meta bm2 ON bm2.id = swc.type
+	LEFT JOIN base_meta bm3 ON bm3.id = swc.structure
+	where sw.valid_flag = 1
+	AND swc.valid_flag = 1
+  </select>
 </mapper>

--
Gitblit v1.9.2