Commit 27331c72 authored by renjie's avatar renjie

子用户ip主账户显示

parent 358c8f65
...@@ -22,6 +22,9 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String ...@@ -22,6 +22,9 @@ public interface IpResourceRepository extends MongoRepository<IpResource, String
List<IpResource> findByOwnerAndIsDeletedAndShopIdIsNull(String owner, boolean isDeleted); List<IpResource> findByOwnerAndIsDeletedAndShopIdIsNull(String owner, boolean isDeleted);
List<IpResource> findByOwnerAndStatusIsNotInAndIsDeletedAndShopIdIsNull(String owner, List<Integer> status, boolean isDeleted); List<IpResource> findByOwnerAndStatusIsNotInAndIsDeletedAndShopIdIsNull(String owner, List<Integer> status, boolean isDeleted);
List<IpResource> findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(String owner, int status, boolean isDeleted); List<IpResource> findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(String owner, int status, boolean isDeleted);
List<IpResource> findByOwnerInAndIsDeletedAndShopIdIsNull(List<String> owner, boolean isDeleted);
List<IpResource> findByOwnerInAndStatusIsNotInAndIsDeletedAndShopIdIsNull(List<String> owner, List<Integer> status, boolean isDeleted);
List<IpResource> findByOwnerInAndStatusAndIsDeletedAndShopIdIsNull(List<String> owner, int status, boolean isDeleted);
List<IpResource> findByStatusAndShopIdInAndIsDeleted(int status, List<String> ipIds, boolean isDeleted); List<IpResource> findByStatusAndShopIdInAndIsDeleted(int status, List<String> ipIds, boolean isDeleted);
Page<IpResource> findByIsDeletedAndIdInAndAddrLikeOrderByPurchasedTimeDesc(boolean isDeleted, List<String> ipIds, String addr, Pageable pageable); Page<IpResource> findByIsDeletedAndIdInAndAddrLikeOrderByPurchasedTimeDesc(boolean isDeleted, List<String> ipIds, String addr, Pageable pageable);
Page<IpResource> findByIsDeletedAndIdInAndVendorCnLikeOrderByPurchasedTimeDesc(boolean isDeleted, List<String> ipIds, String vendorCn, Pageable pageable); Page<IpResource> findByIsDeletedAndIdInAndVendorCnLikeOrderByPurchasedTimeDesc(boolean isDeleted, List<String> ipIds, String vendorCn, Pageable pageable);
......
...@@ -558,21 +558,42 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -558,21 +558,42 @@ public class IpResourceServiceImpl implements IpResourceService {
List<IpResource> ipResources = new ArrayList<>(); List<IpResource> ipResources = new ArrayList<>();
List<IpResource> notUsed = null; List<IpResource> notUsed = null;
List<String> children = new ArrayList<>();
boolean isParent = false;
if (account.getParent() == null) {
isParent = true;
children = accountRepository.findByParent(account.getName()).stream().map(Account::getName).collect(Collectors.toList());
}
children.add(account.getName());
switch (groupType) { switch (groupType) {
case 1: case 1:
ipResources = ipResourceRepository.findByShopIdInAndIsDeleted(shopIds, false); ipResources = ipResourceRepository.findByShopIdInAndIsDeleted(shopIds, false);
notUsed = ipResourceRepository.findByOwnerAndIsDeletedAndShopIdIsNull(username, false); if (isParent)
notUsed = ipResourceRepository.findByOwnerAndIsDeletedAndShopIdIsNull(username, false);
else
notUsed = ipResourceRepository.findByOwnerInAndIsDeletedAndShopIdIsNull(children, false);
break; break;
case 2: case 2:
ipResources = ipResourceRepository.findByStatusAndShopIdInAndIsDeleted(2, shopIds, false); ipResources = ipResourceRepository.findByStatusAndShopIdInAndIsDeleted(2, shopIds, false);
notUsed = ipResourceRepository.findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(username, 2, false); if (isParent)
notUsed = ipResourceRepository.findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(username, 2, false);
else
notUsed = ipResourceRepository.findByOwnerInAndStatusAndIsDeletedAndShopIdIsNull(children, 2, false);
break; break;
case 3: case 3:
ipResources = ipResourceRepository.findByStatusAndShopIdInAndIsDeleted(1, shopIds, false); ipResources = ipResourceRepository.findByStatusAndShopIdInAndIsDeleted(1, shopIds, false);
notUsed = ipResourceRepository.findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(username, 1, false); if (isParent)
notUsed = ipResourceRepository.findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(username, 1, false);
else
notUsed = ipResourceRepository.findByOwnerInAndStatusAndIsDeletedAndShopIdIsNull(children, 1, false);
break; break;
case 4: case 4:
notUsed = ipResourceRepository.findByOwnerAndStatusIsNotInAndIsDeletedAndShopIdIsNull(username, Arrays.asList(3, 5, 6),false); if (isParent)
notUsed = ipResourceRepository.findByOwnerAndStatusIsNotInAndIsDeletedAndShopIdIsNull(username, Arrays.asList(3, 5, 6),false);
else
notUsed = ipResourceRepository.findByOwnerInAndStatusIsNotInAndIsDeletedAndShopIdIsNull(children, Arrays.asList(3, 5, 6), false);
break; break;
} }
if (notUsed != null) if (notUsed != null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment