PDA仓库显示修改
This commit is contained in:
+37
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增仓库
|
||||
|
||||
+3
-3
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user