|
|
@@ -1,6 +1,7 @@
|
|
|
package com.hr.service.impl;
|
|
|
|
|
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.google.common.cache.Cache;
|
|
|
import com.google.common.cache.CacheBuilder;
|
|
|
import com.hr.dto.AggregateQueryDTO;
|
|
|
@@ -13,6 +14,7 @@ import com.hr.util.SnowflakeIdWorker;
|
|
|
import com.hr.vo.IpAccountVO;
|
|
|
import com.yy.basedevelop.dto.LoginUser;
|
|
|
import jakarta.persistence.criteria.Predicate;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.*;
|
|
|
@@ -21,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -56,36 +59,12 @@ public class IpAccountServiceImpl implements IpAccountService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<IpAccountVO> paginQuery(IpAccountParam ipAccountParam, Integer current, Integer size) {
|
|
|
- IpAccountPO ipAccountPO = new IpAccountPO();
|
|
|
- BeanUtils.copyProperties(ipAccountParam, ipAccountPO);
|
|
|
- Pageable pageAble = PageRequest.of(current -1, size);
|
|
|
- Specification<IpAccountPO> spec = (root, query, cb) -> {
|
|
|
-
|
|
|
- List<Predicate> predicates = new ArrayList<>();
|
|
|
- if (ipAccountParam.getAccNo() != null) {
|
|
|
- predicates.add(cb.like(root.get("accNo"), "%" + ipAccountParam.getAccNo() + "%"));
|
|
|
- }
|
|
|
- if(ipAccountParam.getStatus() != null){
|
|
|
- predicates.add(cb.equal(root.get("status"), ipAccountParam.getStatus()));
|
|
|
- }else{
|
|
|
- predicates.add(cb.notLike(root.get("status"), "delete"));
|
|
|
- }
|
|
|
-
|
|
|
- return cb.and(predicates.toArray(new Predicate[0]));
|
|
|
- };
|
|
|
-
|
|
|
- Page<IpAccountPO> page = ipAccountRepository.findAll(spec, pageAble);
|
|
|
- List<IpAccountVO> resultList = new ArrayList<>();
|
|
|
-
|
|
|
- page.getContent().forEach(item -> {
|
|
|
- IpAccountVO vo = new IpAccountVO();
|
|
|
- BeanUtils.copyProperties(item, vo);
|
|
|
- resultList.add(vo);
|
|
|
- });
|
|
|
- Page<IpAccountVO> resultPage = new PageImpl(resultList);
|
|
|
- BeanUtils.copyProperties(page, resultPage);
|
|
|
- return resultPage;
|
|
|
+ public PageInfo<IpAccountVO> paginQuery(IpAccountParam ipAccountParam, Integer current, Integer size) {
|
|
|
+ if (StringUtils.isNotEmpty(ipAccountParam.getStatus())) {
|
|
|
+ ipAccountParam.setStatusList(Arrays.asList(ipAccountParam.getStatus()));
|
|
|
+ }
|
|
|
+ List<IpAccountVO> resultList = ipAccountRepository.queryList(ipAccountParam.getAccNo(),ipAccountParam.getStatusList());
|
|
|
+ return PageInfo.of(resultList);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -160,6 +139,7 @@ public class IpAccountServiceImpl implements IpAccountService {
|
|
|
ipAccountPO.setAddUserId(userId);
|
|
|
ipAccountPO.setAddUserName(userName);
|
|
|
}
|
|
|
+ ipAccountPO.setStatus(accountParam.getStatus());
|
|
|
ipAccountPO.setRemark(accountParam.getRemark());
|
|
|
ipAccountPO.setUpdateTime(LocalDateTime.now());
|
|
|
ipAccountPO.setUpdateUserId(userId);
|