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())); + } + } + /** * 新增盘库计划主 */