| | |
| | | */ |
| | | @ApiOperation(value = "获取crm供应商下的仓库管理列表") |
| | | @PostMapping(value = "/listBySupplierId") |
| | | public R<List<TCrmWarehouse>> listBySupplierId() { |
| | | public R<TCrmWarehouse> listBySupplierId() { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if(roleType == 4){ |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | List<TCrmSupplierToWarehouse> list = crmSupplierToWarehouseService.list(Wrappers.lambdaQuery(TCrmSupplierToWarehouse.class) |
| | | .eq(TCrmSupplierToWarehouse::getSupplierId, crmSupplier.getId())); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return R.ok(); |
| | | } |
| | | List<String> warehouseIds = list.stream().map(TCrmSupplierToWarehouse::getWarehouseId).collect(Collectors.toList()); |
| | | List<TCrmWarehouse> crmWarehouseList = crmWarehouseService.list(Wrappers.lambdaQuery(TCrmWarehouse.class) |
| | | .eq(TCrmWarehouse::getStatus, 1) |
| | | .in(TCrmWarehouse::getId, warehouseIds) |
| | | .orderByDesc(TCrmWarehouse::getCreateTime)); |
| | | return R.ok(crmWarehouseList); |
| | | TCrmWarehouse crmWarehouse = crmWarehouseService.getById(crmSupplier.getWarehouseId()); |
| | | return R.ok(crmWarehouse); |
| | | } |
| | | // if(roleType == 4){ |
| | | // TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | // .eq(TCrmSupplier::getUserId, userId) |
| | | // .last("LIMIT 1")); |
| | | // List<TCrmSupplierToWarehouse> list = crmSupplierToWarehouseService.list(Wrappers.lambdaQuery(TCrmSupplierToWarehouse.class) |
| | | // .eq(TCrmSupplierToWarehouse::getSupplierId, crmSupplier.getId())); |
| | | // if(CollectionUtils.isEmpty(list)){ |
| | | // return R.ok(); |
| | | // } |
| | | // List<String> warehouseIds = list.stream().map(TCrmSupplierToWarehouse::getWarehouseId).collect(Collectors.toList()); |
| | | // List<TCrmWarehouse> crmWarehouseList = crmWarehouseService.list(Wrappers.lambdaQuery(TCrmWarehouse.class) |
| | | // .eq(TCrmWarehouse::getStatus, 1) |
| | | // .in(TCrmWarehouse::getId, warehouseIds) |
| | | // .orderByDesc(TCrmWarehouse::getCreateTime)); |
| | | // return R.ok(crmWarehouseList); |
| | | // } |
| | | return R.ok(); |
| | | } |
| | | |