|
|
@@ -1,7 +1,6 @@
|
|
|
package com.hr.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
import com.google.common.cache.Cache;
|
|
|
import com.google.common.cache.CacheBuilder;
|
|
|
import com.hr.param.InterfaceConfigParam;
|
|
|
@@ -14,6 +13,7 @@ import com.hr.util.SnowflakeIdWorker;
|
|
|
import com.hr.vo.IpInterfaceVO;
|
|
|
import com.hr.vo.NameValueVO;
|
|
|
import com.yy.basedevelop.common.data.BasePageResult;
|
|
|
+import com.yy.basedevelop.dto.LoginUser;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -174,11 +174,24 @@ public class IpInterfaceServiceImpl implements IpInterfaceService {
|
|
|
/**
|
|
|
* 通过主键删除数据
|
|
|
*
|
|
|
- * @param iid 主键
|
|
|
+ * @param iid 主键
|
|
|
+ * @param user
|
|
|
* @return 是否成功
|
|
|
*/
|
|
|
- public boolean deleteById(Long iid){
|
|
|
- ipInterfaceRepository.deleteById(iid);
|
|
|
+ public boolean deleteById(Long iid, LoginUser user){
|
|
|
+ IpInterfacePO ipInterfacePO = ipInterfaceRepository.findById(iid).get();
|
|
|
+ if(ipInterfacePO == null){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Integer countNum = ipInterfaceRepository.countEnableInterfaceRef(iid);
|
|
|
+ if(countNum > 0){
|
|
|
+ throw new RuntimeException("存在激活的接口关联,请先停用关联的接口");
|
|
|
+ }
|
|
|
+ ipInterfacePO.setStatus("delete");
|
|
|
+ ipInterfacePO.setUpdateTime(new Date());
|
|
|
+ ipInterfacePO.setUpdateUserId(user.getUserid());
|
|
|
+ ipInterfacePO.setUpdateUserName(user.getUsername());
|
|
|
+ ipInterfaceRepository.save(ipInterfacePO);
|
|
|
return true;
|
|
|
}
|
|
|
}
|