From 1a8340a0bb7dd7cd72bb6ca5fb5a3e3accda2924 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 22 四月 2022 16:29:22 +0800
Subject: [PATCH] fix

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
index 1b9f5df..d43f65a 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java
@@ -56,12 +56,15 @@
             poleBinding.setDeviceCode(param.getDeviceCode());
             return save(poleBinding);
         } else {
-            //鍒犻櫎鐏潌鐨刣evicescode
-            PoleService poleService = SpringContextHolder.getBean(PoleService.class);
-            Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, one.getPoleId()));
-            if (pole != null) {
-                pole.setDeviceCode(null);
-                poleService.updateById(pole);
+            //淇敼鍗曠伅鐨勭粦瀹氬叧绯荤殑鏃跺�欒棰濆澶勭悊鐨勪簨鍔�
+            // 鍒犻櫎鐏潌鐨刣evicescode
+            if(param.getDeviceType() == 0){
+                PoleService poleService = SpringContextHolder.getBean(PoleService.class);
+                Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, one.getPoleId()));
+                if (pole != null) {
+                    pole.setDeviceCode(null);
+                    poleService.updateById(pole);
+                }
             }
 
             one.setPoleId(poleId);
@@ -87,16 +90,6 @@
             one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode));
         } else {
             one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode).eq(PoleBinding::getPoleId, poleId));
-
-            //鍒犻櫎鐏潌鐨刣evicescode
-            PoleService poleService = SpringContextHolder.getBean(PoleService.class);
-            Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
-            if (pole != null) {
-                pole.setDeviceCode(null);
-                poleService.updateById(pole);
-            }
-
-
         }
         if (one != null) {
             return removeById(one.getId());

--
Gitblit v1.9.3