diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitTypeController.java index e48d2cf..a896964 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/BaseMonitorunitTypeController.java @@ -3,6 +3,8 @@ package com.ruoyi.web.controller.base; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.Ztree; @@ -190,7 +192,8 @@ public class BaseMonitorunitTypeController extends BaseController { @ResponseBody public String checkMonitorUnitTypeIdUnique(BaseMonitorunitType baseMonitorunitType){ List baseMonitorunitTypes = baseMonitorunitTypeService.selectBaseMonitorunitTypeList(baseMonitorunitType); - if(baseMonitorunitTypes.size() > 0){ + List collect = baseMonitorunitTypes.stream().filter(x -> x.getMonitorunittypeId().equals(baseMonitorunitType.getMonitorunittypeId())).collect(Collectors.toList()); + if(collect.size() > 0){ return UserConstants.DEPT_NAME_NOT_UNIQUE; } return UserConstants.DEPT_NAME_UNIQUE;