diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java index edaf5c3..413b593 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseAlarmTypeController.java @@ -3,7 +3,10 @@ package com.ruoyi.web.controller.base; import java.util.Date; import java.util.List; +import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.system.domain.BaseSensorInfo; +import com.ruoyi.system.domain.dto.BaseSensorInfoDto; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -165,4 +168,22 @@ public class BaseAlarmTypeController extends BaseController List ztrees = baseAlarmTypeService.selectBaseAlarmTypeTree(); return ztrees; } + + /** + * 告警类型编号校验 + * @author WenJY + * @date 2022/4/26 21:05 + * @param baseAlarmType + * @return java.lang.String + */ + @PostMapping("/checkAlarmTypeIdUnique") + @ResponseBody + public String checkAlarmTypeIdUnique(BaseAlarmType baseAlarmType){ + List baseAlarmTypes = baseAlarmTypeService.selectBaseAlarmTypeList(baseAlarmType); + + if(baseAlarmTypes.size() > 0){ + return UserConstants.DEPT_NAME_NOT_UNIQUE; + } + return UserConstants.DEPT_NAME_UNIQUE; + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSubstationInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSubstationInfoController.java index 9043c14..e675668 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSubstationInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseSubstationInfoController.java @@ -3,7 +3,9 @@ package com.ruoyi.web.controller.base; import java.util.Date; import java.util.List; +import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.system.domain.BaseAlarmType; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -110,4 +112,15 @@ public class BaseSubstationInfoController extends BaseController { public AjaxResult remove(String ids) { return toAjax(baseSubstationInfoService.deleteBaseSubstationInfoByObjIds(ids)); } + + @PostMapping("/checkSubstationIdIdUnique") + @ResponseBody + public String checkSubstationIdIdUnique(BaseSubstationInfo baseSubstationInfo){ + List baseSubstationInfos = baseSubstationInfoService.selectBaseSubstationInfoList(baseSubstationInfo); + + if(baseSubstationInfos.size() > 0){ + return UserConstants.DEPT_NAME_NOT_UNIQUE; + } + return UserConstants.DEPT_NAME_UNIQUE; + } } diff --git a/ruoyi-admin/src/main/resources/templates/base/alarmType/add.html b/ruoyi-admin/src/main/resources/templates/base/alarmType/add.html index 2042966..40d21c7 100644 --- a/ruoyi-admin/src/main/resources/templates/base/alarmType/add.html +++ b/ruoyi-admin/src/main/resources/templates/base/alarmType/add.html @@ -42,6 +42,29 @@