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/controller/PoleController.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
index f52e11f..d1eface 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -8,6 +8,7 @@
 import com.sandu.common.domain.ResponseVO;
 import com.sandu.common.object.BaseConditionVO;
 import com.sandu.common.util.ResponseUtil;
+import com.sandu.common.util.SpringContextHolder;
 import com.sandu.ximon.admin.dto.DeviceStatus;
 import com.sandu.ximon.admin.param.PoleBindParam;
 import com.sandu.ximon.admin.param.PoleBindingParam;
@@ -124,7 +125,7 @@
             switch (param.getDeviceType()) {
                 case 0:
                     Pole pole = poleService.getById(poleId);
-                    if (!pole.getDeviceCode().equals(param.getDeviceCode())) {
+                    if (pole != null) {
                         pole.setPoleName(param.getDeviceName());
                         pole.setDeviceCode(param.getDeviceCode());
                         poleService.updateById(pole);
@@ -166,12 +167,18 @@
      * 鐏潌缁戝畾璁惧
      */
     @PostMapping("/unBind/{poleId}")
-    public ResponseVO<Object> unBindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) {
+    public ResponseVO<Object> unBindPole(@PathVariable Long poleId, @RequestBody PoleBindingParam param) {
         boolean result = poleService.unBindPole(poleId, param.getDeviceCode());
         if (result) {
-            //璁惧绫诲瀷锛�0璺伅锛�1led灞忓箷锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�
+            //璁惧绫诲瀷锛�0璺伅锛�1led灞忓箷锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�, 10鐔欒
             switch (param.getDeviceType()) {
                 case 0:
+                    //鍒犻櫎鐏潌鐨刣evicescode
+                    Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
+                    if (pole != null) {
+                        pole.setDeviceCode(null);
+                        poleService.updateById(pole);
+                    }
                     break;
                 case 1:
                     break;

--
Gitblit v1.9.3