From 2e53fdad625825a7cfb24b849494ebb5026a4d67 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期四, 10 十一月 2022 09:30:47 +0800
Subject: [PATCH] changes

---
 dao/src/main/resources/mapper/PoleBindingMapper.xml |   36 ++++++++++++++++++++++++++++--------
 1 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/dao/src/main/resources/mapper/PoleBindingMapper.xml b/dao/src/main/resources/mapper/PoleBindingMapper.xml
index 23aaa92..92f0a44 100644
--- a/dao/src/main/resources/mapper/PoleBindingMapper.xml
+++ b/dao/src/main/resources/mapper/PoleBindingMapper.xml
@@ -5,18 +5,38 @@
 <mapper namespace="com.sandu.ximon.dao.mapper.PoleBindingMapper">
 
     <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.PoleBinding">
-            <id property="id" column="id" jdbcType="BIGINT"/>
-            <result property="poleId" column="pole_id" jdbcType="BIGINT"/>
-            <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
-            <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
-            <result property="deviceType" column="device_type" jdbcType="INTEGER"/>
-            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
-            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <id property="id" column="id" jdbcType="BIGINT"/>
+        <result property="poleId" column="pole_id" jdbcType="BIGINT"/>
+        <result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
+        <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
+        <result property="deviceType" column="device_type" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <sql id="Base_Column_List">
-        id,pole_id,device_name,
+        id
+        ,pole_id,device_name,
         device_code,device_type,create_time,
         update_time
     </sql>
+    <select id="getPoleByBinding" resultType="com.sandu.ximon.dao.domain.Pole">
+        SELECT t2.*
+        FROM `pole_binding` t1
+        LEFT JOIN pole t2 ON t1.pole_id = t2.id
+        <where>
+            t1.device_code = #{Mac}
+            AND t1.device_type=0
+            <if test="type != null">
+                AND t1.device_type = #{type}
+            </if>
+            <if test="userId != null">
+                AND (
+                t2.user_id = #{userId}
+                OR t2.client_id = #{userId}
+                )
+            </if>
+        </where>
+
+    </select>
 </mapper>

--
Gitblit v1.9.3