From 4a4179b19501059168bd2d725bf6294708c99ec3 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 06 六月 2023 16:37:34 +0800
Subject: [PATCH] 添加Voc的地址

---
 src/main/resources/mapping/VocValsMapper.xml |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/mapping/VocValsMapper.xml b/src/main/resources/mapping/VocValsMapper.xml
index 413b18a..8155c12 100644
--- a/src/main/resources/mapping/VocValsMapper.xml
+++ b/src/main/resources/mapping/VocValsMapper.xml
@@ -7,13 +7,15 @@
         <result property="y" column="y" />
         <result property="val" column="val" />
         <result property="createTime" column="create_time" />
+        <result property="addr" column="addr" />
     </resultMap>
 
     <select id="selectByTime" resultMap="selectMap">
-        select x, y, format(val, 2) "val"
-        from voc_vals
-        where date_format(create_time, '%Y%m%d%H') = ${time}
-            and val > (select jcyj from alert_config);
+        select a.x, a.y, format(a.val, 2) "val", b.addr
+        from voc_vals a inner join voc_addr b
+        on a.x = b.x and a.y = b.y
+        where date_format(a.create_time, '%Y%m%d%H') = ${time}
+            and a.val > (select jcyj from alert_config);
     </select>
 
     <select id="countByTime" resultType="java.lang.Integer">
@@ -22,6 +24,20 @@
         where date_format(create_time, '%Y%m%d%H') = ${time};
     </select>
 
+    <select id="selectCoords" resultType="com.yssh.entity.VocCoords">
+        select x, y, addr
+        from voc_addr
+        <where>
+            1 = 1
+            <if test="x != null">
+                and x = ${x}
+            </if>
+            <if test="y != null">
+                and y = ${y}
+            </if>
+        </where>
+    </select>
+
     <insert id="insert" parameterType="com.yssh.entity.VocVals" useGeneratedKeys="false" keyProperty="id">
         insert into voc_vals (id, x, y, val, create_time) values
         (${id}, ${x}, ${y}, ${val}, ${createTime});

--
Gitblit v1.9.3