longhu 5 өдөр өмнө
parent
commit
185e8c4b16

+ 9 - 0
src/main/java/com/hr/service/impl/IpTokenInterfaceServiceImpl.java

@@ -249,6 +249,15 @@ public class IpTokenInterfaceServiceImpl implements IpTokenInterfaceService {
         IpTokenPO ipTokenPO;
         // 校验唯一性
         if(id != null){
+            List<IpTokenInterfacePO> interfaceList = ipTokenInterfaceRepository.queryRefList(param.getAccountId(), param.getInterfaceId());
+            if(!interfaceList.isEmpty()){
+                for (IpTokenInterfacePO tokenInterfacePO : interfaceList) {
+                    if(!tokenInterfacePO.getId().equals(id)){
+                        throw new RuntimeException("该账号下已存在对应接口");
+                    }
+                }
+            }
+
             ipTokenInterfacePO = ipTokenInterfaceRepository.findById(param.getId()).get();
             ipTokenPO = ipTokenRepository.findById(ipTokenInterfacePO.getTid()).get();
             if(ipTokenPO == null){