From 25eca015c9edb5a8ab3fd9d68a8fd785619c1372 Mon Sep 17 00:00:00 2001
From: lyfO_o <764716047@qq.com>
Date: 星期一, 28 二月 2022 11:24:48 +0800
Subject: [PATCH] 仓库状态温湿度阈值警报字段

---
 src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml |  246 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 236 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml b/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml
index 25b2cd3..a843b61 100644
--- a/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/OpeReagentStatusDao.xml
@@ -145,11 +145,11 @@
 	    <if test="status != null">
 	    	<choose>
 	    		<when test="status == 1">
-	    			 left join sys_warehouse as sw on sw.id = oa.house_id
+					left join sys_warehouse as sw on sw.id = oa.house_id
 	    			 left join sys_warehouse_container as swc on swc.id = oa.container_id
 	    		</when>
 	    		<when test="status == 2">
-	    			 left join sys_laboratory as sw on sw.id = oa.house_id
+					left join sys_laboratory as sw on sw.id = oa.house_id
 	    			 left join sys_laboratory_container as swc on swc.id = oa.container_id
 	    		</when>
 	    	</choose>
@@ -205,13 +205,104 @@
     </if>
   </select>
 
-	<select id="getOpeReagentStatusListForLab" parameterType="java.util.Map" resultMap="OpeReagentStatus">
-		<include refid="queryColumns"/>
-		from ope_reagent_status as oa
-		<include refid="queryJoins"/>
-		where oa.valid_flag = 1
-		<include refid="queryWhereSqlForLab"/>
 
+    <select id="getOpeReagentStatusList22" parameterType="java.util.Map" resultMap="OpeReagentStatus">
+        <include refid="queryColumns"/>
+        from ope_reagent_status as oa
+        left join sys_reagent sr on oa.reagent_id = sr.id
+        left join sys_supplier as ss on sr.supplier_id = ss.id
+        left join sys_user as su on oa.user_id = su.id
+
+        <if test="status != null">
+            <choose>
+                <when test="status == 1">
+                    inner join sys_warehouse as sw on sw.id = oa.house_id
+                    left join sys_warehouse_container as swc on swc.id = oa.container_id
+                </when>
+                <when test="status == 2">
+                    inner join sys_laboratory as sw on sw.id = oa.house_id
+                    left join sys_laboratory_container as swc on swc.id = oa.container_id
+                </when>
+            </choose>
+        </if>
+        where oa.valid_flag = 1
+        <include refid="queryWhereSql"/>
+
+        order by oa.reagent_code asc
+        <if test="first != null and pageSize != null">
+            limit #{first}, #{pageSize}
+        </if>
+    </select>
+
+	<select id="getOpeReagentStatusListForLab" parameterType="java.util.Map" resultMap="OpeReagentStatus">
+		select oa.*,
+		sr.*,
+		sr.id as reagentId,
+		su.name as userName,
+		<if test="status != null">
+			<choose>
+				<when test="status == 1 or status == 2">
+					swc.container_code as containerCode,
+					sw.name as houseName,
+				</when>
+			</choose>
+		</if>
+		ss.name as supplierName
+		from ope_reagent_status as oa
+		left join sys_reagent sr on oa.reagent_id = sr.id
+		left join sys_supplier as ss on sr.supplier_id = ss.id
+		left join sys_user as su on oa.user_id = su.id
+		<if test="status != null">
+			<choose>
+				<when test="status == 1">
+					left join sys_warehouse as sw on sw.id = oa.house_id
+					left join sys_warehouse_container as swc on swc.id = oa.container_id
+				</when>
+				<when test="status == 2">
+					left join sys_laboratory as sw on sw.id = oa.house_id
+					left join sys_laboratory_container as swc on swc.id = oa.container_id
+				</when>
+			</choose>
+		</if>
+		where oa.valid_flag = 1
+		<if test="reagentId != null and reagentId != ''">
+			and oa.reagent_id = #{reagentId}
+		</if>
+		<if test="userId != null and userId != ''">
+			and oa.user_id = #{userId}
+		</if>
+		<if test="department != null and department != ''">
+			and sw.department = #{department}
+		</if>
+		<if test="departmentUserIds != null">
+			and oa.user_id in
+			<foreach collection="departmentUserIds" item="item" index="index" open="(" separator="," close=")">
+				#{item}
+			</foreach>
+		</if>
+		<if test="articleNumber != null and articleNumber != ''">
+			and oa.article_number = #{articleNumber}
+		</if>
+		<if test="editId != null and editId != ''">
+			and oa.id != #{editId}
+		</if>
+		<if test="reagentCode != null and reagentCode != ''">
+			and oa.reagent_code like #{reagentCode}
+		</if>
+		<if test="status != null">
+			and oa.status = #{status}
+		</if>
+		<if test="name != null and name != ''">
+			and sr.name like #{name}
+		</if>
+		<choose>
+			<when test="status == 2 and project != null and project != ''">
+				and sw.project like concat("%",#{project},"%")
+			</when>
+            <when test="status == 2 and labName != null and labName != ''">
+                and sw.name like concat("%",#{labName},"%")
+            </when>
+		</choose>
 		order by oa.reagent_code asc
 		<if test="first != null and pageSize != null">
 			limit #{first}, #{pageSize}
@@ -251,9 +342,60 @@
 	<select id="getOpeReagentStatusTotalCountForLab" parameterType="java.util.Map" resultType="int">
 		select count(1)
 		from ope_reagent_status as oa
-		<include refid="queryJoins"/>
+		left join sys_reagent sr on oa.reagent_id = sr.id
+		left join sys_supplier as ss on sr.supplier_id = ss.id
+		left join sys_user as su on oa.user_id = su.id
+		<if test="status != null">
+			<choose>
+				<when test="status == 1">
+					left join sys_warehouse as sw on sw.id = oa.house_id
+					left join sys_warehouse_container as swc on swc.id = oa.container_id
+				</when>
+				<when test="status == 2">
+					left join sys_laboratory as sw on sw.id = oa.house_id
+					left join sys_laboratory_container as swc on swc.id = oa.container_id
+				</when>
+			</choose>
+		</if>
 		where oa.valid_flag = 1
-		<include refid="queryWhereSqlForLab"/>
+		<if test="reagentId != null and reagentId != ''">
+			and oa.reagent_id = #{reagentId}
+		</if>
+		<if test="userId != null and userId != ''">
+			and oa.user_id = #{userId}
+		</if>
+		<if test="department != null and department != ''">
+			and sw.department = #{department}
+		</if>
+		<if test="departmentUserIds != null">
+			and oa.user_id in
+			<foreach collection="departmentUserIds" item="item" index="index" open="(" separator="," close=")">
+				#{item}
+			</foreach>
+		</if>
+		<if test="articleNumber != null and articleNumber != ''">
+			and oa.article_number = #{articleNumber}
+		</if>
+		<if test="editId != null and editId != ''">
+			and oa.id != #{editId}
+		</if>
+		<if test="reagentCode != null and reagentCode != ''">
+			and oa.reagent_code like #{reagentCode}
+		</if>
+		<if test="status != null">
+			and oa.status = #{status}
+		</if>
+		<if test="name != null and name != ''">
+			and sr.name like #{name}
+		</if>
+		<choose>
+			<when test="status == 2 and project != null and project != ''">
+				and sw.project like concat("%",#{project},"%")
+			</when>
+            <when test="status == 2 and labName != null and labName != ''">
+                and sw.name like concat("%",#{labName},"%")
+            </when>
+		</choose>
 	</select>
 
   <select id="getPersonReagentStatusTotalCount" parameterType="java.util.Map" resultType="int">
@@ -450,4 +592,88 @@
 			and house_id = #{warehouseId}
 		</if>
 	</select>
+	<select id="selectExportList" resultType="java.util.Map">
+		select oa.article_number articleNumber,
+		oa.reagent_code reagentCode,
+		oa.remainder,
+		bm1.meta_value productHome,
+		bm2.meta_value reagentFomart,
+		sr.name reagentName,
+		sr.cas cas,
+		<if test="status != null">
+			<choose>
+				<when test="status == 1 or status == 2">
+					swc.container_code as containerCode,
+					sw.name as houseName,
+				</when>
+			</choose>
+		</if>
+		ss.name as supplierName
+		from ope_reagent_status as oa
+		left join sys_reagent sr on oa.reagent_id = sr.id
+		left join base_meta bm1 on bm1.id = sr.product_home
+		left join base_meta bm2 on bm2.id = sr.reagent_format
+		left join sys_supplier as ss on sr.supplier_id = ss.id
+		left join sys_user as su on oa.user_id = su.id
+		<if test="status != null">
+			<choose>
+				<when test="status == 1">
+					left join sys_warehouse as sw on sw.id = oa.house_id
+					left join sys_warehouse_container as swc on swc.id = oa.container_id
+				</when>
+				<when test="status == 2">
+					left join sys_laboratory as sw on sw.id = oa.house_id
+					left join sys_laboratory_container as swc on swc.id = oa.container_id
+				</when>
+			</choose>
+		</if>
+		where oa.valid_flag = 1
+		<if test="reagentId != null and reagentId != ''">
+			and oa.reagent_id = #{reagentId}
+		</if>
+		<if test="userId != null and userId != ''">
+			and oa.user_id = #{userId}
+		</if>
+		<if test="department != null and department != ''">
+			and sw.department = #{department}
+		</if>
+		<if test="departmentUserIds != null">
+			and oa.user_id in
+			<foreach collection="departmentUserIds" item="item" index="index" open="(" separator="," close=")">
+				#{item}
+			</foreach>
+		</if>
+		<if test="articleNumber != null and articleNumber != ''">
+			and oa.article_number = #{articleNumber}
+		</if>
+		<if test="editId != null and editId != ''">
+			and oa.id != #{editId}
+		</if>
+		<if test="reagentCode != null and reagentCode != ''">
+			and oa.reagent_code like  concat("%",#{reagentCode},"%")
+		</if>
+		<if test="status != null">
+			and oa.status = #{status}
+		</if>
+		<if test="name != null and name != ''">
+			and sr.name like concat("%",#{name},"%")
+		</if>
+		<choose>
+			<when test="status == 2 and project != null and project != ''">
+				and sw.project like concat("%",#{project},"%")
+			</when>
+            <when test="status == 2 and labName != null and labName != ''">
+                and sw.name like concat("%",#{labName},"%")
+            </when>
+		</choose>
+		order by oa.reagent_code asc
+	</select>
+    <select id="getStatus" resultMap="OpeReagentStatus">
+
+		  select *
+        from ope_reagent_status
+        where valid_flag = 1
+        and reagent_code = #{reagentCode}
+        and reagent_id = #{reagentId}
+	</select>
 </mapper>

--
Gitblit v1.9.2