Browse Source

机构-上级check校验问题

sigezuishuai 3 years ago
parent
commit
2a1d6105a6

+ 5 - 2
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgFwcdCwServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.organization.service.impl;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.ext.api.enums.RoomManagementStatus;
@@ -142,8 +143,10 @@ public class YljgFwcdCwServiceImpl implements IYljgFwcdCwService
         YljgFwcdFj fj = new YljgFwcdFj();
         fj.setId(yljgFwcdCw.getFjId());
         fj.setSfzm("1");
-        if(yljgFwcdFjMapper.selectYljgFwcdFjList(fj).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgFwcdCw.getFjId())){
+            if(yljgFwcdFjMapper.selectYljgFwcdFjList(fj).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
     }
 

+ 6 - 2
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgFwcdFjServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruoyi.organization.service.impl;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.ext.api.enums.RoomManagementStatus;
@@ -163,9 +164,12 @@ public class YljgFwcdFjServiceImpl implements IYljgFwcdFjService
         YljgFwcdLc lc = new YljgFwcdLc();
         lc.setId(yljgFwcdFj.getLcId());
         lc.setLczt("1");
-        if(yljgFwcdLcMapper.selectYljgFwcdLcList(lc).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgFwcdFj.getLcId())){
+            if(yljgFwcdLcMapper.selectYljgFwcdLcList(lc).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
+
     }
 
 }

+ 5 - 3
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgFwcdLcServiceImpl.java

@@ -146,7 +146,7 @@ public class YljgFwcdLcServiceImpl implements IYljgFwcdLcService
     @Override
     public void checkExist(YljgFwcdLc yljgFwcdLc) {
         LambdaQueryWrapper<YljgFwcdLc> lqw = new LambdaQueryWrapper<YljgFwcdLc>()
-                .eq(ObjectUtil.isNotNull(yljgFwcdLc.getLyId()), YljgFwcdLc::getLyId, yljgFwcdLc.getLyId())
+                .eq(YljgFwcdLc::getLyId, yljgFwcdLc.getLyId())
                 .and(wrapper -> wrapper
                         .eq(YljgFwcdLc::getLcmc, yljgFwcdLc.getLcmc())
                         .eq(YljgFwcdLc::getLczt, yljgFwcdLc.getLczt())
@@ -165,8 +165,10 @@ public class YljgFwcdLcServiceImpl implements IYljgFwcdLcService
         YljgFwcdLy ly =new YljgFwcdLy();
         ly.setId(yljgFwcdLc.getLyId());
         ly.setLyzt("1");
-        if(yljgFwcdLyMapper.selectYljgFwcdLyList(ly).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgFwcdLc.getLyId())){
+            if(yljgFwcdLyMapper.selectYljgFwcdLyList(ly).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
     }
 }

+ 9 - 5
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgYgBtxxServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.organization.service.impl;
 
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.organization.domain.YljgYgBtxx;
@@ -67,12 +68,15 @@ public class YljgYgBtxxServiceImpl implements IYljgYgBtxxService
     }
 
     public void checkParentIdExist(YljgYgBtxx yljgYgBtxx){
-        YljgYgJbxx yg = new YljgYgJbxx();
-        yg.setId(yljgYgBtxx.getCyryId());
-        yg.setState(0L);
-        if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgYgBtxx.getCyryId())){
+            YljgYgJbxx yg = new YljgYgJbxx();
+            yg.setId(yljgYgBtxx.getCyryId());
+            yg.setState(0L);
+            if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
+
     }
 
 

+ 8 - 5
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgYgCfxxServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.organization.service.impl;
 
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.organization.domain.YljgYgBtxx;
@@ -69,11 +70,13 @@ public class YljgYgCfxxServiceImpl implements IYljgYgCfxxService
     }
 
     public void checkParentIdExist(YljgYgCfxx yljgYgCfxx){
-        YljgYgJbxx yg = new YljgYgJbxx();
-        yg.setId(yljgYgCfxx.getCyryId());
-        yg.setState(0L);
-        if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgYgCfxx.getCyryId())){
+            YljgYgJbxx yg = new YljgYgJbxx();
+            yg.setId(yljgYgCfxx.getCyryId());
+            yg.setState(0L);
+            if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
     }
 

+ 8 - 5
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgYgCyjlServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.organization.service.impl;
 
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.organization.domain.YljgYgCyjl;
@@ -67,11 +68,13 @@ public class YljgYgCyjlServiceImpl implements IYljgYgCyjlService
     }
 
     public void checkParentIdExist(YljgYgCyjl yljgYgCyjl){
-        YljgYgJbxx yg = new YljgYgJbxx();
-        yg.setId(yljgYgCyjl.getCyryId());
-        yg.setState(0L);
-        if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgYgCyjl.getCyryId())){
+            YljgYgJbxx yg = new YljgYgJbxx();
+            yg.setId(yljgYgCyjl.getCyryId());
+            yg.setState(0L);
+            if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
     }
 

+ 8 - 5
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgYgJlxxServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.organization.service.impl;
 
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.organization.domain.YljgYgJbxx;
@@ -67,11 +68,13 @@ public class YljgYgJlxxServiceImpl implements IYljgYgJlxxService
     }
 
     public void checkParentIdExist(YljgYgJlxx yljgYgJlxx){
-        YljgYgJbxx yg = new YljgYgJbxx();
-        yg.setId(yljgYgJlxx.getCyryId());
-        yg.setState(0L);
-        if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgYgJlxx.getCyryId())){
+            YljgYgJbxx yg = new YljgYgJbxx();
+            yg.setId(yljgYgJlxx.getCyryId());
+            yg.setState(0L);
+            if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
     }
 

+ 8 - 5
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgYgPxjlServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.organization.service.impl;
 
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.organization.domain.YljgYgJbxx;
@@ -67,11 +68,13 @@ public class YljgYgPxjlServiceImpl implements IYljgYgPxjlService
     }
 
     public void checkParentIdExist(YljgYgPxjl yljgYgPxjl){
-        YljgYgJbxx yg = new YljgYgJbxx();
-        yg.setId(yljgYgPxjl.getCyryId());
-        yg.setState(0L);
-        if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgYgPxjl.getCyryId())){
+            YljgYgJbxx yg = new YljgYgJbxx();
+            yg.setId(yljgYgPxjl.getCyryId());
+            yg.setState(0L);
+            if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
     }
 

+ 8 - 5
ruoyi-modules/mz-organization/src/main/java/com/ruoyi/organization/service/impl/YljgYgZzxxServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.organization.service.impl;
 
 import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.uuid.IdUtils;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.organization.domain.YljgYgJbxx;
@@ -67,11 +68,13 @@ public class YljgYgZzxxServiceImpl implements IYljgYgZzxxService
     }
 
     public void checkParentIdExist(YljgYgZzxx yljgYgZzxx){
-        YljgYgJbxx yg = new YljgYgJbxx();
-        yg.setId(yljgYgZzxx.getCyryId());
-        yg.setState(0L);
-        if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
-            throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+        if(StringUtils.isNotBlank(yljgYgZzxx.getCyryId())){
+            YljgYgJbxx yg = new YljgYgJbxx();
+            yg.setId(yljgYgZzxx.getCyryId());
+            yg.setState(0L);
+            if(yljgYgJbxxMapper.selectYljgYgJbxxList(yg).size()!=1){
+                throw new ServiceException("父级信息不存在/失效,操作失败,请检查其信息");
+            }
         }
     }