PDA仓库显示修改

This commit is contained in:
秦鸿展
2026-03-13 10:56:34 +08:00
parent b90b27fd2c
commit 8e6a88bd7f
2 changed files with 40 additions and 3 deletions
@@ -1,9 +1,12 @@
package com.mhd.basic.application.service.warehouse;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO;
import com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO;
import com.mhd.basic.domain.areaAggregate.service.SysProvinceCityCountyDomainService;
import com.mhd.basic.domain.associationWarehouse.entity.AssociationWarehouse;
import com.mhd.basic.domain.associationWarehouse.repository.facade.IAssociationWarehouseService;
import com.mhd.basic.domain.warehouse.repository.po.WarehousePO;
import com.mhd.basic.domain.warehouse.repository.po.po.WarehouseLinkagePO;
import com.mhd.basic.domain.warehouse.repository.todo.WarehouseDO;
@@ -17,8 +20,11 @@ import com.mhd.system.service.ISysDictTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 仓库ApplicationService
*
@@ -34,6 +40,8 @@ public class WarehouseApplicationService {
private ISysDictTypeService dictTypeService;
@Autowired
private SysProvinceCityCountyDomainService sysProvinceCityCountyDomainService;
@Autowired
private IAssociationWarehouseService associationWarehouseService;
/**
@@ -93,6 +101,35 @@ public class WarehouseApplicationService {
return warehouseDomainService.queryList(warehouseDO);
}
/**
* 查询当前用户绑定的仓库列表(用于App端,只返回用户关联的仓库)
*/
public List<WarehousePO> queryListByApp(WarehouseDO warehouseDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserid() == null) {
return Collections.emptyList();
}
// 查询当前用户绑定的仓库ID列表
List<AssociationWarehouse> associationList = associationWarehouseService.list(
new QueryWrapper<AssociationWarehouse>().lambda()
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
.eq(AssociationWarehouse::getDelFlag, 1)
.select(AssociationWarehouse::getWarehouseId));
if (CollectionUtils.isEmpty(associationList)) {
return Collections.emptyList();
}
List<Long> warehouseIds = associationList.stream()
.map(AssociationWarehouse::getWarehouseId)
.filter(ObjectUtil::isNotNull)
.distinct()
.collect(Collectors.toList());
if (warehouseIds.isEmpty()) {
return Collections.emptyList();
}
warehouseDO.setWarehouseIds(warehouseIds);
return warehouseDomainService.queryList(warehouseDO);
}
/**
* 新增仓库
@@ -56,15 +56,15 @@ public class WarehouseApi extends BaseController{
}
/**
* 分页查询仓库列表
* 查询仓库列表App端,只返回当前用户绑定的仓库)
*/
@ApiOperation("查询仓库列表")
@ApiOperation("查询仓库列表(仅当前用户绑定的仓库)")
@GetMapping("/listByApp")
public AjaxResult listByApp(WarehouseDTO warehouseDTO)
{
//转换实体
WarehouseDO warehouseDO = warehouseAssembler.toDO(warehouseDTO);
List<WarehousePO> list = warehouseApplicationService.queryList(warehouseDO);
List<WarehousePO> list = warehouseApplicationService.queryListByApp(warehouseDO);
return AjaxResult.success(list);
}