feat(inventory): 添加盘库计划关联库区列表查询功能
- 在 InvCountPlanServiceImpl 中新增 warehouseMapper 依赖注入 - 修改 queryPageList 方法以联查盘库计划关联的库区列表 - 修改 queryList 方法以联查盘库计划关联的库区列表 - 新增 setWarehouseList 方法实现批量设置库区列表逻辑 - 在 InvCountPlanVo 中新增 warehouseList 字段存储库区列表 - 更新 .gitignore 文件添加 *.toml 忽略规则
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -64,3 +64,4 @@ nbdist/
|
|||||||
*.py
|
*.py
|
||||||
*.pyc
|
*.pyc
|
||||||
*.json
|
*.json
|
||||||
|
*.toml
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.klp.flow.domain.vo;
|
package com.klp.flow.domain.vo;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
@@ -108,5 +109,9 @@ public class InvCountPlanVo {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 盘库计划关联的库区列表
|
||||||
|
*/
|
||||||
|
private List<InvCountPlanWarehouseVo> warehouseList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ import com.klp.flow.service.IInvCountPlanService;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
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业务层处理
|
* 盘库计划主Service业务层处理
|
||||||
@@ -30,6 +35,7 @@ import java.util.Collection;
|
|||||||
public class InvCountPlanServiceImpl implements IInvCountPlanService {
|
public class InvCountPlanServiceImpl implements IInvCountPlanService {
|
||||||
|
|
||||||
private final InvCountPlanMapper baseMapper;
|
private final InvCountPlanMapper baseMapper;
|
||||||
|
private final InvCountPlanWarehouseMapper warehouseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询盘库计划主
|
* 查询盘库计划主
|
||||||
@@ -46,6 +52,10 @@ public class InvCountPlanServiceImpl implements IInvCountPlanService {
|
|||||||
public TableDataInfo<InvCountPlanVo> queryPageList(InvCountPlanBo bo, PageQuery pageQuery) {
|
public TableDataInfo<InvCountPlanVo> queryPageList(InvCountPlanBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<InvCountPlan> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<InvCountPlan> lqw = buildQueryWrapper(bo);
|
||||||
Page<InvCountPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<InvCountPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
// 联查盘库计划关联的库区列表
|
||||||
|
if (result != null && result.getRecords() != null && !result.getRecords().isEmpty()) {
|
||||||
|
setWarehouseList(result.getRecords());
|
||||||
|
}
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +65,12 @@ public class InvCountPlanServiceImpl implements IInvCountPlanService {
|
|||||||
@Override
|
@Override
|
||||||
public List<InvCountPlanVo> queryList(InvCountPlanBo bo) {
|
public List<InvCountPlanVo> queryList(InvCountPlanBo bo) {
|
||||||
LambdaQueryWrapper<InvCountPlan> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<InvCountPlan> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
List<InvCountPlanVo> list = baseMapper.selectVoList(lqw);
|
||||||
|
// 联查盘库计划关联的库区列表
|
||||||
|
if (list != null && !list.isEmpty()) {
|
||||||
|
setWarehouseList(list);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<InvCountPlan> buildQueryWrapper(InvCountPlanBo bo) {
|
private LambdaQueryWrapper<InvCountPlan> buildQueryWrapper(InvCountPlanBo bo) {
|
||||||
@@ -76,6 +91,21 @@ public class InvCountPlanServiceImpl implements IInvCountPlanService {
|
|||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量设置盘库计划关联的库区列表
|
||||||
|
*/
|
||||||
|
private void setWarehouseList(List<InvCountPlanVo> planList) {
|
||||||
|
List<Long> planIds = planList.stream().map(InvCountPlanVo::getPlanId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<InvCountPlanWarehouse> wq = Wrappers.lambdaQuery();
|
||||||
|
wq.in(InvCountPlanWarehouse::getPlanId, planIds);
|
||||||
|
List<InvCountPlanWarehouseVo> warehouseVos = warehouseMapper.selectVoList(wq);
|
||||||
|
Map<Long, List<InvCountPlanWarehouseVo>> warehouseMap = warehouseVos.stream()
|
||||||
|
.collect(Collectors.groupingBy(InvCountPlanWarehouseVo::getPlanId));
|
||||||
|
for (InvCountPlanVo vo : planList) {
|
||||||
|
vo.setWarehouseList(warehouseMap.getOrDefault(vo.getPlanId(), Collections.emptyList()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增盘库计划主
|
* 新增盘库计划主
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user