From 04bede5143bebe71270ef602c42c7fa9d063abbe Mon Sep 17 00:00:00 2001
From: gdg <764716047@qq.com>
Date: 星期三, 23 十二月 2020 16:46:48 +0800
Subject: [PATCH] 获取仓库信息

---
 src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 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..554dea7 100644
--- a/src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/SysWarehouseDao.xml
@@ -14,6 +14,27 @@
     <result property="updateTime" column="update_time"></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="sysWarehouseContainerDto" 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">
     <if test="type != null and type != ''">
       and su.type = #{type}
@@ -79,4 +100,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