From 84b7d5223a5f5229866a7d5686d198cca4251453 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 26 九月 2025 15:23:25 +0800 Subject: [PATCH] 代码提交,查询部门下级递归 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AssetTypeServiceImpl.java | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AssetTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AssetTypeServiceImpl.java index a28fcd9..a9fb969 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AssetTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AssetTypeServiceImpl.java @@ -13,9 +13,11 @@ import com.ruoyi.system.mapper.AssetTypeMapper; import com.ruoyi.system.model.AssetMain; import com.ruoyi.system.model.AssetType; +import com.ruoyi.system.query.AssetStatisticsListDetailQuery; import com.ruoyi.system.query.AssetStatisticsListQuery; import com.ruoyi.system.service.AssetMainService; import com.ruoyi.system.service.AssetTypeService; +import com.ruoyi.system.vo.AssetStatisticsDetailVO; import com.ruoyi.system.vo.AssetStatisticsVO; import com.ruoyi.system.vo.asset.AssetTypeTreeVO; import com.ruoyi.system.vo.system.NotificationVO; @@ -48,6 +50,7 @@ public class AssetTypeServiceImpl extends ServiceImpl<AssetTypeMapper, AssetType> implements AssetTypeService { private final AssetMainService assetMainService; + private final AssetTypeService assetTypeService; @Override public List<AssetTypeTreeVO> getAssetTypeTree() { @@ -319,7 +322,9 @@ if (assetTypeIds.isEmpty()){ return new PageInfo<>(); } - Map<Integer, List<AssetMain>> assetMainMap = assetMainService.lambdaQuery().in(AssetMain::getAssetTypeId, assetTypeIds).list() + Map<Integer, List<AssetMain>> assetMainMap = assetMainService.lambdaQuery() + .eq(AssetMain::getOwnershipDeptId, query.getDeptId()) + .in(AssetMain::getAssetTypeId, assetTypeIds).list() .stream() .collect(Collectors.groupingBy(AssetMain::getAssetTypeId)); for (AssetStatisticsVO asset : list) { @@ -357,4 +362,38 @@ return pageInfo; } + @Override + public PageInfo<AssetStatisticsDetailVO> pageListDetail(AssetStatisticsListDetailQuery query) { + String assetTypeName = null; + AssetType assetType = assetTypeService.getById(query.getAssetTypeIdSecond()); + if (assetType!=null){ + AssetType assetTypeParent = assetTypeService.getById(assetType.getParentId()); + if (assetTypeParent!=null){ + assetTypeName = assetTypeParent.getTypeName()+">"+assetType.getTypeName(); + } + } + + if (StringUtils.hasLength(query.getNameOrCode())){ + // 查询出资产名称或者资产编号符合条件的code + List<Integer> assetTypeIds = assetMainService.lambdaQuery().like(AssetMain::getAssetName, query.getNameOrCode()) + .or() + .like(AssetMain::getAssetCode, query.getNameOrCode()) + .list() + .stream() + .map(AssetMain::getAssetTypeId) + .collect(Collectors.toList()); + query.setAssetMainIds(assetTypeIds); + if (assetTypeIds.isEmpty()){ + return new PageInfo<>(); + } + } + PageInfo<AssetStatisticsDetailVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); + List<AssetStatisticsDetailVO> list = this.baseMapper.pageListDetail(query,pageInfo); + for (AssetStatisticsDetailVO assetStatisticsDetailVO : list) { + assetStatisticsDetailVO.setAssetTypeName(assetTypeName); + } + pageInfo.setRecords(list); + return pageInfo; + } + } -- Gitblit v1.7.1