From 52eb3f0befcb397d2fdd645c8d7471d6ee477f87 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期一, 09 五月 2022 16:36:38 +0800
Subject: [PATCH] 权限

---
 dao/src/main/resources/mapper/AirDataMapper.xml |   52 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/dao/src/main/resources/mapper/AirDataMapper.xml b/dao/src/main/resources/mapper/AirDataMapper.xml
index 68e7ac5..889c5c3 100644
--- a/dao/src/main/resources/mapper/AirDataMapper.xml
+++ b/dao/src/main/resources/mapper/AirDataMapper.xml
@@ -31,11 +31,53 @@
         <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
     </resultMap>
 
-    <select id="listAirEquipmentMAC" resultType="java.lang.String">
-            SELECT DISTINCT
-            device_mac
-            FROM
-             air_data
+    <select id="listAirId" resultType="java.lang.Long">
+        SELECT
+        MAX(t1.id) AS air_id
+        FROM
+        air_data t1
+        <if test="keyword != null and keyword != ''">
+            LEFT JOIN pole_binding t2 ON t1.device_mac = t2.device_code
+            AND t2.device_type = 3
+            LEFT JOIN pole t3 ON t3.id = t2.pole_id
+        </if>
+        <where>
+            <if test="keyword != null and keyword != ''">
+                AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
+            </if>
+            <if test="userid != null">
+                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
+            </if>
+        </where>
+        GROUP BY
+        t1.device_mac
     </select>
 
+    <select id="listAirDataByIds" resultType="com.sandu.ximon.dao.bo.AirDataBo">
+        SELECT
+        t1.*, t2.pole_id,
+        t3.pole_name
+        FROM
+        air_data t1
+        LEFT JOIN pole_binding t2 ON t1.device_mac = t2.device_code
+        AND t2.device_type = 3
+        LEFT JOIN pole t3 ON t3.id = t2.pole_id
+        <where>
+            t1.id IN
+            <foreach collection="airIdList" open="(" close=")" item="airId" separator=",">
+                #{airId}
+            </foreach>
+        </where>
+    </select>
+    <select id="getCodeByPoleId" resultType="java.lang.String">
+        select t1.device_code
+        from pole_binding t1
+        left join pole t2 on t1.pole_id = t2.id
+        where t1.device_type = 3
+        and t1.pole_id = #{poleId}
+        <if test="clientId != null">
+            AND (t2.user_id = #{clientId} OR t2.client_id = #{clientId})
+        </if>
+
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3