longhu 6 天之前
父节点
当前提交
b2d6c1d707

+ 2 - 0
src/main/java/com/hr/repository/jpa/IpTokenInterfaceRepository.java

@@ -18,4 +18,6 @@ public interface IpTokenInterfaceRepository extends JpaRepository<IpTokenInterfa
     IpTokenInterfacePO findByAidAndIid(Long aid, Long iid);
 
     BasePageResult<IpTokenInterfacePO> queryList(@Param("aid") Long aid, @Param("statusList") List<String> statusList);
+
+    List<IpTokenInterfacePO> queryRefList(@Param("accountId") Long accountId, @Param("interfaceId") Long interfaceId);
 }

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

@@ -257,8 +257,8 @@ public class IpTokenInterfaceServiceImpl implements IpTokenInterfaceService {
                 throw new RuntimeException("参数异常");
             }
         }else{
-            IpTokenInterfacePO ipTokenInterfacePO1 = ipTokenInterfaceRepository.findByAidAndIid(param.getAccountId(), param.getInterfaceId());
-            if(ipTokenInterfacePO1 != null){
+            List<IpTokenInterfacePO> interfaceList = ipTokenInterfaceRepository.queryRefList(param.getAccountId(), param.getInterfaceId());
+            if(!interfaceList.isEmpty()){
                 throw new RuntimeException("该账号下已存在对应接口");
             }
 

+ 3 - 0
src/main/resources/mapper/IpTokenInterfaceMapper.xml

@@ -8,4 +8,7 @@
     <select id="queryList" resultType="com.hr.repository.domain.IpTokenInterfacePO">
         select * from ip_token_interface where 1=1 and aid = :aid and status in(:statusList)
     </select>
+    <select id="queryRefList" resultType="com.hr.repository.domain.IpTokenInterfacePO">
+        select * from ip_token_interface where 1=1 and aid = :accountId and iid = :interfaceId and status != 'delete'
+    </select>
 </mapper>