|
@@ -1,5 +1,7 @@
|
|
|
package com.hr.service.impl;
|
|
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.Cache;
|
|
|
import com.google.common.cache.CacheBuilder;
|
|
import com.google.common.cache.CacheBuilder;
|
|
|
import com.hr.param.InterfaceConfigParam;
|
|
import com.hr.param.InterfaceConfigParam;
|
|
@@ -12,6 +14,7 @@ import com.hr.util.SnowflakeIdWorker;
|
|
|
import com.hr.vo.IpAccountVO;
|
|
import com.hr.vo.IpAccountVO;
|
|
|
import com.hr.vo.IpInterfaceVO;
|
|
import com.hr.vo.IpInterfaceVO;
|
|
|
import com.hr.vo.NameValueVO;
|
|
import com.hr.vo.NameValueVO;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.*;
|
|
import org.springframework.data.domain.*;
|
|
@@ -20,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -60,25 +64,13 @@ public class IpInterfaceServiceImpl implements IpInterfaceService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Page<IpInterfaceVO> paginQuery(IpInterfaceParam interfaceParam, Integer current, Integer size) {
|
|
|
|
|
- IpInterfacePO ipInterfacePO = new IpInterfacePO();
|
|
|
|
|
- BeanUtils.copyProperties(interfaceParam, ipInterfacePO);
|
|
|
|
|
- ExampleMatcher matcher = ExampleMatcher.matchingAll()
|
|
|
|
|
- .withIgnoreNullValues() // 忽略 null 字段
|
|
|
|
|
- .withIgnoreCase();
|
|
|
|
|
- Pageable pageAble = PageRequest.of(current - 1 , size);
|
|
|
|
|
- Example<IpInterfacePO> example = Example.of(ipInterfacePO, matcher);
|
|
|
|
|
- Page<IpInterfacePO> page = ipInterfaceRepository.findAll(example, pageAble);
|
|
|
|
|
- List<IpInterfaceVO> resultList = new ArrayList<>();
|
|
|
|
|
-
|
|
|
|
|
- page.getContent().forEach(item -> {
|
|
|
|
|
- IpInterfaceVO vo = new IpInterfaceVO();
|
|
|
|
|
- BeanUtils.copyProperties(item, vo);
|
|
|
|
|
- resultList.add(vo);
|
|
|
|
|
- });
|
|
|
|
|
- Page<IpInterfaceVO> resultPage = new PageImpl(resultList);
|
|
|
|
|
- BeanUtils.copyProperties(page, resultPage);
|
|
|
|
|
- return resultPage;
|
|
|
|
|
|
|
+ public PageInfo<IpInterfaceVO> paginQuery(IpInterfaceParam interfaceParam, Integer current, Integer size) {
|
|
|
|
|
+ PageHelper.startPage(interfaceParam.getPageNum(), interfaceParam.getPageSize());
|
|
|
|
|
+ if (StringUtils.isNotEmpty(interfaceParam.getStatus())) {
|
|
|
|
|
+ interfaceParam.setStatusList(Arrays.asList(interfaceParam.getStatus()));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<IpInterfaceVO> dbList = ipInterfaceRepository.queryPage(interfaceParam);
|
|
|
|
|
+ return PageInfo.of(dbList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|