From e55c8b0a92eb9715edd90c31dfd4de51a47b588b Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 04 十一月 2022 17:40:08 +0800
Subject: [PATCH] changes

---
 dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml |   48 ++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml b/dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml
index f736cc0..28e4b14 100644
--- a/dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml
+++ b/dao/src/main/resources/mapper/PoleLightemitEntityMapper.xml
@@ -22,7 +22,8 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        lightemit_id,lightemit_name,lightemit_control_code,
+        lightemit_id
+        ,lightemit_name,lightemit_control_code,
         url,play_time,add_time,
         request_body,player_setting,status,
         remark,create_user_id,create_time
@@ -36,18 +37,53 @@
 
     <select id="listLed" resultType="com.sandu.ximon.dao.domain.PoleLightemitEntity">
         SELECT
-        t1.*, t2.pole_id,
-        t3.pole_name as streetlight_name , t3.id
+        t1.*, t2.pole_id as streetlight_id,
+        t3.pole_name as streetlight_name, t3.id
         FROM
         pole_lightemit t1
         LEFT JOIN pole_binding t2 ON t1.lightemit_control_code = t2.device_code
-        AND t2.device_type = 1
+        AND t2.device_type = 10
         LEFT JOIN pole t3 ON t3.id = t2.pole_id
         <where>
             <if test="keyword != null and keyword != ''">
-                AND t1.lightemit_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
+                AND (t1.lightemit_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                 OR t1.lightemit_control_code LIKE CONCAT(CONCAT('%', #{keyword}), '%')
-                OR t1.lightemit_id LIKE CONCAT(CONCAT('%', #{keyword}), '%')
+                OR t1.lightemit_id LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
+            </if>
+            <if test="userid != null">
+                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
+            </if>
+        </where>
+        <if test="orderBy != null">
+            ORDER BY ${orderBy}
+        </if>
+    </select>
+    <select id="getpole" resultType="com.sandu.ximon.dao.domain.Pole" parameterType="java.lang.String">
+        SELECT
+        t1.*
+        FROM
+        pole t1
+        LEFT JOIN pole_binding t2 ON t1.id = t2.pole_id
+        LEFT JOIN pole_lightemit t3 ON t2.device_code = t3.lightemit_control_code
+        WHERE
+        t2.device_type = 10
+        <if test="lightemitControlCode != null">
+            AND t3.lightemit_control_code = #{lightemitControlCode}
+        </if>
+    </select>
+    <select id="listLedOnBinding" resultType="com.sandu.ximon.dao.domain.PoleLightemitEntity">
+        SELECT
+        t1.*, t2.pole_id as streetlight_id,
+        t3.pole_name as streetlight_name, t3.id
+        FROM
+        pole_lightemit t1
+        LEFT JOIN pole_binding t2 ON t1.lightemit_control_code = t2.device_code
+        AND t2.device_type = 10
+        LEFT JOIN pole t3 ON t3.id = t2.pole_id
+        <where>
+            <if test="keyword != null and keyword != ''">
+                AND (t1.lightemit_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
+                OR t1.lightemit_control_code LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
             </if>
             <if test="userid != null">
                 AND (t3.user_id = #{userid} OR t3.client_id = #{userid})

--
Gitblit v1.9.3