From 33ecbd69aca2ccc58d47f467f3f7266b37fa9dfc Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 27 五月 2022 18:44:38 +0800
Subject: [PATCH] fix

---
 dao/src/main/resources/mapper/LightMapper.xml |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/dao/src/main/resources/mapper/LightMapper.xml b/dao/src/main/resources/mapper/LightMapper.xml
index f764d06..0cb6575 100644
--- a/dao/src/main/resources/mapper/LightMapper.xml
+++ b/dao/src/main/resources/mapper/LightMapper.xml
@@ -70,4 +70,28 @@
             </if>
         </where>
     </select>
+    <select id="listLightOnBinding" resultType="com.sandu.ximon.dao.bo.LightBo">
+        SELECT
+        t1.*,
+        t2.id AS pole_id,
+        t2.pole_code,
+        t2.pole_name,
+        t4.task_name
+        FROM
+        light t1
+        LEFT JOIN pole t2 USING ( device_code )
+        LEFT JOIN light_task_pole_relation t3 ON t3.pole_id = t2.id
+        LEFT JOIN light_task t4 ON t3.task_id = t4.task_id
+        <where>
+            <if test="clientId != null">
+                AND (t2.user_id = #{clientId} OR t2.client_id = #{clientId})
+            </if>
+            <if test="keyword != null and keyword != ''">
+                AND (
+                t1.device_code LIKE CONCAT('%', #{keyword},'%')
+                OR t1.light_id LIKE CONCAT('%', #{keyword},'%')
+                )
+            </if>
+        </where>
+    </select>
 </mapper>

--
Gitblit v1.9.3