From 623dd23d3f06ec0382cca8e013d998d63ba7d1d0 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期一, 27 十二月 2021 18:28:23 +0800
Subject: [PATCH] 水质设备

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleBindingService.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 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 3c2ea62..1d9de0c 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
@@ -1,9 +1,9 @@
 package com.sandu.ximon.admin.service;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.sandu.common.execption.BusinessException;
 import com.sandu.common.service.impl.BaseServiceImpl;
 import com.sandu.ximon.admin.param.PoleBindingParam;
-import com.sandu.ximon.dao.domain.LightReportData;
 import com.sandu.ximon.dao.domain.PoleBinding;
 import com.sandu.ximon.dao.enums.PoleBindingEnums;
 import com.sandu.ximon.dao.mapper.PoleBindingMapper;
@@ -22,15 +22,23 @@
 
     public boolean bindPole(Long poleId, PoleBindingParam param) {
         Integer deviceType = param.getDeviceType();
-        if (PoleBindingEnums.LIGHT.getCode().equals(deviceType)) {
+//        if (PoleBindingEnums.LIGHT.getCode().equals(deviceType)) {
+//        }
+
+        PoleBinding one = getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, param.getDeviceCode()));
+        if (one == null) {
             PoleBinding poleBinding = new PoleBinding();
             poleBinding.setPoleId(poleId);
             poleBinding.setDeviceType(deviceType);
             poleBinding.setDeviceName(param.getDeviceName());
-            poleBinding.setDeviceMac(param.getDeviceMac());
+            poleBinding.setDeviceCode(param.getDeviceCode());
             return save(poleBinding);
+        } else {
+            throw new BusinessException("璇ヨ澶囧凡缁戝畾杩�");
         }
 
-        return false;
+
+//        return false;
+
     }
 }

--
Gitblit v1.9.3