From c7b899735f7a25a2ab3ffcea33dae2ffe5d59d91 Mon Sep 17 00:00:00 2001 From: Joshi <3040996759@qq.com> Date: Wed, 24 Jun 2026 16:51:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(inventory):=20=E6=B7=BB=E5=8A=A0=E7=9B=98?= =?UTF-8?q?=E5=BA=93=E8=AE=A1=E5=88=92=E5=85=B3=E8=81=94=E5=BA=93=E5=8C=BA?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 InvCountPlanServiceImpl 中新增 warehouseMapper 依赖注入 - 修改 queryPageList 方法以联查盘库计划关联的库区列表 - 修改 queryList 方法以联查盘库计划关联的库区列表 - 新增 setWarehouseList 方法实现批量设置库区列表逻辑 - 在 InvCountPlanVo 中新增 warehouseList 字段存储库区列表 - 更新 .gitignore 文件添加 *.toml 忽略规则 --- .gitignore | 1 + .../klp/flow/domain/vo/InvCountPlanVo.java | 5 +++ .../service/impl/InvCountPlanServiceImpl.java | 32 ++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 609afbed2..e5578cc1d 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ nbdist/ *.py *.pyc *.json +*.toml diff --git a/klp-flow/src/main/java/com/klp/flow/domain/vo/InvCountPlanVo.java b/klp-flow/src/main/java/com/klp/flow/domain/vo/InvCountPlanVo.java index e4f417df0..0e2839d89 100644 --- a/klp-flow/src/main/java/com/klp/flow/domain/vo/InvCountPlanVo.java +++ b/klp-flow/src/main/java/com/klp/flow/domain/vo/InvCountPlanVo.java @@ -1,6 +1,7 @@ package com.klp.flow.domain.vo; import java.util.Date; +import java.util.List; import com.fasterxml.jackson.annotation.JsonFormat; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; @@ -108,5 +109,9 @@ public class InvCountPlanVo { @ExcelProperty(value = "备注") private String remark; + /** + * 盘库计划关联的库区列表 + */ + private List warehouseList; } diff --git a/klp-flow/src/main/java/com/klp/flow/service/impl/InvCountPlanServiceImpl.java b/klp-flow/src/main/java/com/klp/flow/service/impl/InvCountPlanServiceImpl.java index 720a44984..3315d42a4 100644 --- a/klp-flow/src/main/java/com/klp/flow/service/impl/InvCountPlanServiceImpl.java +++ b/klp-flow/src/main/java/com/klp/flow/service/impl/InvCountPlanServiceImpl.java @@ -18,6 +18,11 @@ import com.klp.flow.service.IInvCountPlanService; import java.util.List; import java.util.Map; import java.util.Collection; +import java.util.Collections; +import java.util.stream.Collectors; +import com.klp.flow.domain.InvCountPlanWarehouse; +import com.klp.flow.domain.vo.InvCountPlanWarehouseVo; +import com.klp.flow.mapper.InvCountPlanWarehouseMapper; /** * 盘库计划主Service业务层处理 @@ -30,6 +35,7 @@ import java.util.Collection; public class InvCountPlanServiceImpl implements IInvCountPlanService { private final InvCountPlanMapper baseMapper; + private final InvCountPlanWarehouseMapper warehouseMapper; /** * 查询盘库计划主 @@ -46,6 +52,10 @@ public class InvCountPlanServiceImpl implements IInvCountPlanService { public TableDataInfo queryPageList(InvCountPlanBo bo, PageQuery pageQuery) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + // 联查盘库计划关联的库区列表 + if (result != null && result.getRecords() != null && !result.getRecords().isEmpty()) { + setWarehouseList(result.getRecords()); + } return TableDataInfo.build(result); } @@ -55,7 +65,12 @@ public class InvCountPlanServiceImpl implements IInvCountPlanService { @Override public List queryList(InvCountPlanBo bo) { LambdaQueryWrapper lqw = buildQueryWrapper(bo); - return baseMapper.selectVoList(lqw); + List list = baseMapper.selectVoList(lqw); + // 联查盘库计划关联的库区列表 + if (list != null && !list.isEmpty()) { + setWarehouseList(list); + } + return list; } private LambdaQueryWrapper buildQueryWrapper(InvCountPlanBo bo) { @@ -76,6 +91,21 @@ public class InvCountPlanServiceImpl implements IInvCountPlanService { return lqw; } + /** + * 批量设置盘库计划关联的库区列表 + */ + private void setWarehouseList(List planList) { + List planIds = planList.stream().map(InvCountPlanVo::getPlanId).collect(Collectors.toList()); + LambdaQueryWrapper wq = Wrappers.lambdaQuery(); + wq.in(InvCountPlanWarehouse::getPlanId, planIds); + List warehouseVos = warehouseMapper.selectVoList(wq); + Map> warehouseMap = warehouseVos.stream() + .collect(Collectors.groupingBy(InvCountPlanWarehouseVo::getPlanId)); + for (InvCountPlanVo vo : planList) { + vo.setWarehouseList(warehouseMap.getOrDefault(vo.getPlanId(), Collections.emptyList())); + } + } + /** * 新增盘库计划主 */