From 4e2254d32c8b110e851a2a0a361f7bf37fb93ad5 Mon Sep 17 00:00:00 2001 From: wenjy Date: Tue, 26 Apr 2022 09:38:39 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E4=BC=A0=E6=84=9F=E5=99=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0=E7=BC=96=E5=8F=B7=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/BaseSensorInfoController.java | 14 +++++++- .../templates/base/sensorInfo/add.html | 35 +++++++++++++++++-- .../templates/base/sensorInfo/edit.html | 6 ++-- .../templates/base/sensorInfo/sensorInfo.html | 7 ++-- 4 files changed, 53 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java index 4939a0f..2a74017 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSensorInfoController.java @@ -3,9 +3,11 @@ package com.ruoyi.web.controller.base; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; import com.alibaba.fastjson.JSONArray; import com.mysql.cj.xdevapi.JsonArray; +import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.system.domain.BaseAlarmInfo; import com.ruoyi.system.domain.BaseAlarmType; @@ -115,10 +117,20 @@ public class BaseSensorInfoController extends BaseController { /** 新增传感器信息 */ @GetMapping("/add") - public String add() { + public String add(ModelMap mmap) { return prefix + "/add"; } + @PostMapping("/checkSensorIdUnique") + @ResponseBody + public String checkSensorIdUnique(BaseSensorInfo baseSensorInfo){ + List baseSensorInfoDtos = baseSensorInfoService.selectBaseSensorInfoList(baseSensorInfo); + if(baseSensorInfoDtos.size() > 0){ + return UserConstants.DEPT_NAME_NOT_UNIQUE; + } + return UserConstants.DEPT_NAME_UNIQUE; + } + /** 新增保存传感器信息 */ @RequiresPermissions("base:sensorInfo:add") @Log(title = "传感器信息", businessType = BusinessType.INSERT) diff --git a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/add.html b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/add.html index 1f81f49..d5ddef6 100644 --- a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/add.html +++ b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/add.html @@ -37,7 +37,7 @@ -
+
@@ -87,6 +87,29 @@ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/edit.html b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/edit.html index d285f8a..29843f6 100644 --- a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/edit.html +++ b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/edit.html @@ -17,7 +17,7 @@
- +
@@ -35,14 +35,14 @@
-
+
diff --git a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html index 765fb7f..3ca6184 100644 --- a/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html +++ b/ruoyi-admin/src/main/resources/templates/base/sensorInfo/sensorInfo.html @@ -50,14 +50,14 @@ th:value="${dict.sensortypeId}"> -
  • +
  •  搜索 @@ -191,7 +191,8 @@ title: '传感器状态', formatter: function (value, row, index) { return $.table.selectDictLabel(sensorStatusDatas, value); - } + }, + visible: false }, { field: 'monitorunitName',