From 47a751cb301d05276ae5d75145d57b2d090fe4e1 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: Mon, 01 Jul 2024 10:58:35 +0800
Subject: [PATCH] change
---
src/main/java/com/nanometer/smartlab/dao/SysContainerSensorsDao.xml | 67 ++++++++++++++++++++++++++++-----
1 files changed, 56 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/nanometer/smartlab/dao/SysContainerSensorsDao.xml b/src/main/java/com/nanometer/smartlab/dao/SysContainerSensorsDao.xml
index 70ba19d..6d227ae 100644
--- a/src/main/java/com/nanometer/smartlab/dao/SysContainerSensorsDao.xml
+++ b/src/main/java/com/nanometer/smartlab/dao/SysContainerSensorsDao.xml
@@ -20,22 +20,19 @@
<sql id="Base_Column_List">
id, container_id, temp, humidity, voc1, flag, type, update_time
</sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap">
+ select
<include refid="Base_Column_List" />
from sys_container_sensors
where id = #{id,jdbcType=VARCHAR}
</select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+ <delete id="deleteByPrimaryKey" >
delete from sys_container_sensors
where id = #{id,jdbcType=VARCHAR}
</delete>
- <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.SysContainerSensors">
+ <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.SysContainerSensors" useGeneratedKeys = "true" keyProperty = "id">
insert into sys_container_sensors
<trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
<if test="containerId != null">
container_id,
</if>
@@ -59,9 +56,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
<if test="containerId != null">
#{containerId,jdbcType=VARCHAR},
</if>
@@ -156,6 +150,9 @@
<if test="beginUpdateTime != null ">
and s.update_time >= #{beginUpdateTime}
</if>
+ <if test="endUpdateTime != null ">
+ and s.update_time <= #{endUpdateTime}
+ </if>
</where>
</sql>
<sql id="sql_limit">
@@ -243,4 +240,52 @@
ORDER BY
slc.update_time DESC
</select>
-</mapper>
\ No newline at end of file
+ <select id="getRowData" resultType="com.nanometer.smartlab.entity.dto.ContainerStatusMngDto">
+ SELECT slc.id,slc.temp, slc.humidity,slc.voc1 ,sl.name as laboratoryName,slc.name laboratoryContainerName,slc.flag,
+ CASE
+ WHEN substring(flag, 1,1) = '1' THEN TRUE ELSE FALSE END AS lowTempAlert,
+ CASE
+ WHEN substring(flag, 2,1) = '1' THEN TRUE ELSE FALSE END AS highTempAlert,
+ CASE
+ WHEN substring(flag, 3,1) = '1' THEN TRUE ELSE FALSE END AS lowHumidityAlert,
+ CASE
+ WHEN substring(flag, 4,1) = '1' THEN TRUE ELSE FALSE END AS highHumidityAlert,
+ CASE
+ WHEN substring(flag, 5,1) = '1' THEN TRUE ELSE FALSE END AS voc1Alert
+ from sys_laboratory_container slc
+ LEFT JOIN sys_laboratory sl ON sl.id = slc.laboratory_id
+ where slc.id = #{id}
+
+
+ </select>
+ <select id="selectMaxTemperature" resultType="java.util.Map">
+ select max(s.temp) maxTemperature,min(s.temp) minTemperature
+ from sys_container_sensors as s
+ where
+ s.container_id = #{id}
+ and s.update_time >= #{beginDate}
+ <if test="endDate != null">
+ and s.update_time < #{endDate}
+ </if>
+ </select>
+ <select id="selectMaxHumidity" resultType="java.util.Map">
+ select max(s.humidity) maxHumidity, min(s.humidity) minHumidity
+ from sys_container_sensors as s
+ where
+ s.container_id = #{id}
+ and s.update_time >= #{beginDate}
+ <if test="endDate != null">
+ and s.update_time < #{endDate}
+ </if>
+ </select>
+ <select id="selectMaxVoc" resultType="java.util.Map">
+ select max(s.voc1) maxVoc, min(s.voc1) minVoc
+ from sys_container_sensors as s
+ where
+ s.container_id = #{id}
+ and s.update_time >= #{beginDate}
+ <if test="endDate != null">
+ and s.update_time < #{endDate}
+ </if>
+ </select>
+</mapper>
--
Gitblit v1.9.2