From 19d542ddaa4a2d5a737912505e3195948ffa9ebe Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期四, 04 八月 2022 10:48:34 +0800
Subject: [PATCH] changes

---
 dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java             |    4 ++--
 dao/src/main/resources/mapper/PoleMapper.xml                             |    8 ++++++--
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java |    5 +++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java b/dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java
index 14f1786..ce85d49 100644
--- a/dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java
+++ b/dao/src/main/java/com/sandu/ximon/dao/mapper/PoleMapper.java
@@ -1,7 +1,7 @@
 package com.sandu.ximon.dao.mapper;
 
-import com.sandu.ximon.dao.domain.Pole;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sandu.ximon.dao.domain.Pole;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -15,7 +15,7 @@
 
     boolean updateDeviceCode(Long id);
 
-    List<Pole> queryPoleOnLineStatesList(Long userid, Integer isTrue, Integer bingStates, Long groupid, String keyword,Integer center, String orderBy);
+    List<Pole> queryPoleOnLineStatesList(Long userid, Integer isTrue, Integer bingStates, Long groupid, String keyword, Integer centre, String orderBy);
 
     List<Pole> getPoleListOnBinding(Long userid, String keyword);
 }
diff --git a/dao/src/main/resources/mapper/PoleMapper.xml b/dao/src/main/resources/mapper/PoleMapper.xml
index c9169df..e05972e 100644
--- a/dao/src/main/resources/mapper/PoleMapper.xml
+++ b/dao/src/main/resources/mapper/PoleMapper.xml
@@ -47,6 +47,7 @@
         LEFT JOIN pole_group_relation t2 ON t1.id = t2.pole_id
         LEFT JOIN pole_group t3 ON t3.group_id = t2.pole_group_id
         <where>
+            1=1
             <if test="userid != null">
                 AND (t1.user_id = #{userid} OR t1.client_id = #{userid})
             </if>
@@ -70,8 +71,11 @@
             <if test="bingStates != null and bingStates == 1 ">
                 AND t1.user_id = -1
             </if>
-            <if test="center != null and center != ''">
-                AND t1.centre = #{center}
+            <if test="centre != null and centre == 0">
+                AND t1.centre = 0
+            </if>
+            <if test="centre != null and centre == 1">
+                AND t1.centre = 1
             </if>
         </where>
         GROUP BY t1.id
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
index ded784c..9cf84ce 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -262,12 +262,13 @@
         String orderBy = "t1." + orderByResult + " " + orderBySeq;
 
         List<Pole> poleList;
+        Integer center = param.getCenter();
         if (SecurityUtils.getClientId() == null) {
             poleList = poleMapper.queryPoleOnLineStatesList(null, param.getIsTrue(),
-                    param.getBingStates(), param.getGroupid(), param.getKeyword(), param.getCenter(), orderBy);
+                    param.getBingStates(), param.getGroupid(), param.getKeyword(), center, orderBy);
         } else {
             poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(),
-                    param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword(), param.getCenter(), orderBy);
+                    param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword(), center, orderBy);
         }
 
         poleList.forEach(

--
Gitblit v1.9.3