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',