|
|
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* 账户表;(ip_account)表服务接口实现类
|
|
|
@@ -89,10 +90,11 @@ public class IpAccountServiceImpl implements IpAccountService {
|
|
|
|
|
|
@Override
|
|
|
public Boolean switchStatus(SwitchStatusParam switchStatusParam) {
|
|
|
- IpAccountPO ipAccountPO = ipAccountRepository.queryById(switchStatusParam.getId());
|
|
|
- if(ipAccountPO == null){
|
|
|
+ Optional<IpAccountPO> optional = ipAccountRepository.findById(switchStatusParam.getId());
|
|
|
+ if(!optional.isPresent()){
|
|
|
throw new RuntimeException("接口不存在");
|
|
|
}
|
|
|
+ IpAccountPO ipAccountPO = optional.get();
|
|
|
ipAccountPO.setStatus(switchStatusParam.getStatus());
|
|
|
ipAccountRepository.save(ipAccountPO);
|
|
|
return true;
|