yaowanxin
9 天以前 7d188cc913d5ea547c5e99ae434ea3b1cf4e818a
仓库货架业务流程修改
已修改7个文件
252 ■■■■ 文件已修改
src/main/java/com/ruoyi/warehouse/controller/WarehouseController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesRowcolController.java 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/pojo/Documentation.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesRowcolServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java 96 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseServiceImpl.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/warehouse/controller/WarehouseController.java
@@ -1,14 +1,16 @@
package com.ruoyi.warehouse.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.ruoyi.warehouse.pojo.Warehouse;
import com.ruoyi.warehouse.pojo.WarehouseGoodsShelves;
import com.ruoyi.warehouse.service.WarehouseGoodsShelvesService;
import com.ruoyi.warehouse.service.WarehouseService;
import io.swagger.annotations.Api;
@@ -26,7 +28,6 @@
    @Autowired
    private WarehouseService warehouseService;
    @GetMapping("/listPage")
    @ApiOperation("仓库-查询")
    @Log(title = "仓库-查询", businessType = BusinessType.OTHER)
@@ -37,7 +38,7 @@
    @ApiOperation("仓库-添加")
    @Log(title = "仓库-添加", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody Warehouse warehouse) {
        return warehouseService.save(warehouse) ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败");
        return AjaxResult.success(warehouseService.save(warehouse));
    }
    @PostMapping("/update")
@@ -52,6 +53,6 @@
    @Log(title = "仓库-删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        return warehouseService.deleteByIds(ids) ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
        return AjaxResult.success(warehouseService.deleteByIds(ids));
    }
}
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java
@@ -43,22 +43,19 @@
    @ApiOperation("商品货架-添加")
    @Log(title = "商品货架-添加", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) {
        boolean save = warehouseGoodsShelvesService.add(warehouseGoodsShelves);
        return save ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败");
        return AjaxResult.success(warehouseGoodsShelvesService.add(warehouseGoodsShelves));
    }
    @PostMapping("/update")
    @ApiOperation("商品货架-更新")
    @Log(title = "商品货架-更新", businessType = BusinessType.UPDATE)
    public AjaxResult update(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) {
        boolean update = warehouseGoodsShelvesService.updateRowcolById(warehouseGoodsShelves);
        return update ? AjaxResult.success("更新成功") : AjaxResult.error("更新失败");
        return AjaxResult.success(warehouseGoodsShelvesService.updateRowcolById(warehouseGoodsShelves));
    }
    @DeleteMapping("/delete")
    @ApiOperation("商品货架-删除")
    @Log(title = "商品货架-删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        boolean remove = warehouseGoodsShelvesService.deleteByIds(ids);
        return remove ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
        return  AjaxResult.success(warehouseGoodsShelvesService.deleteByIds(ids));
    }
}
src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesRowcolController.java
@@ -25,36 +25,39 @@
    private WarehouseGoodsShelvesRowcolService warehouseGoodsShelvesRowcolService;
    @Autowired
    private WarehouseGoodsShelvesRowcolMapper warehouseGoodsShelvesRowcolMapper;
    @GetMapping("/listPage")
    @ApiOperation("商品货架行列-分页查询")
    @Log(title = "商品货架行列-分页查询", businessType = BusinessType.OTHER)
    public AjaxResult listPage(Page page, WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
        IPage<WarehouseGoodsShelvesRowcol> listPage = warehouseGoodsShelvesRowcolService.listPage(page, warehouseGoodsShelvesRowcol);
        return AjaxResult.success(listPage);
    @GetMapping("/list")
    @ApiOperation("商品货架行列-查询")
    @Log(title = "商品货架行列-查询", businessType = BusinessType.OTHER)
    public AjaxResult list() {
        List<WarehouseGoodsShelvesRowcol> list = warehouseGoodsShelvesRowcolService.list();
        return AjaxResult.success(list);
    }
    @PostMapping("/add")
    @ApiOperation("商品货架行列-添加")
    @Log(title = "商品货架行列-添加", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
        boolean save = warehouseGoodsShelvesRowcolService.save(warehouseGoodsShelvesRowcol);
        return save ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败");
    }
    @PostMapping("/update")
    @ApiOperation("商品货架行列-更新")
    @Log(title = "商品货架行列-更新", businessType = BusinessType.UPDATE)
    public AjaxResult update(@RequestBody WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
        boolean up = warehouseGoodsShelvesRowcolService.updateById(warehouseGoodsShelvesRowcol);
        return up ? AjaxResult.success("更新成功") : AjaxResult.error("更新失败");
    }
    @PostMapping("/delete")
    @ApiOperation("商品货架行列-删除")
    @Log(title = "商品货架行列-删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
        boolean remove = warehouseGoodsShelvesRowcolService.deleteByIds(ids);
        return remove ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
    }
//    @GetMapping("/listPage")
//    @ApiOperation("商品货架行列-分页查询")
//    @Log(title = "商品货架行列-分页查询", businessType = BusinessType.OTHER)
//    public AjaxResult listPage(Page page, WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
//        IPage<WarehouseGoodsShelvesRowcol> listPage = warehouseGoodsShelvesRowcolService.listPage(page, warehouseGoodsShelvesRowcol);
//        return AjaxResult.success(listPage);
//    }
//    @PostMapping("/add")
//    @ApiOperation("商品货架行列-添加")
//    @Log(title = "商品货架行列-添加", businessType = BusinessType.INSERT)
//    public AjaxResult add(@RequestBody WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
//        return AjaxResult.success(warehouseGoodsShelvesRowcolService.save(warehouseGoodsShelvesRowcol));
//    }
//    @PostMapping("/update")
//    @ApiOperation("商品货架行列-更新")
//    @Log(title = "商品货架行列-更新", businessType = BusinessType.UPDATE)
//    public AjaxResult update(@RequestBody WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
//        return AjaxResult.success(warehouseGoodsShelvesRowcolService.updateById(warehouseGoodsShelvesRowcol));
//    }
//    @PostMapping("/delete")
//    @ApiOperation("商品货架行列-删除")
//    @Log(title = "商品货架行列-删除", businessType = BusinessType.DELETE)
//    public AjaxResult delete(@RequestBody List<Long> ids) {
//        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID");
//        return AjaxResult.success(warehouseGoodsShelvesRowcolService.removeByIds(ids));
//    }
}
src/main/java/com/ruoyi/warehouse/pojo/Documentation.java
@@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -73,6 +74,7 @@
     */
    @Excel(name = "文档日期")
    @ApiModelProperty(value = "文档日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime docDate;
    /**
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesRowcolServiceImpl.java
@@ -1,10 +1,14 @@
package com.ruoyi.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.warehouse.mapper.DocumentationMapper;
import com.ruoyi.warehouse.mapper.WarehouseGoodsShelvesRowcolMapper;
import com.ruoyi.warehouse.pojo.Documentation;
import com.ruoyi.warehouse.pojo.WarehouseGoodsShelvesRowcol;
import com.ruoyi.warehouse.service.WarehouseGoodsShelvesRowcolService;
import lombok.extern.slf4j.Slf4j;
@@ -12,6 +16,7 @@
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
@@ -25,6 +30,8 @@
    implements WarehouseGoodsShelvesRowcolService {
    @Autowired
    private WarehouseGoodsShelvesRowcolMapper warehouseGoodsShelvesRowcolMapper;
    @Autowired
    private DocumentationMapper documentationMapper;
    @Override
    public IPage<WarehouseGoodsShelvesRowcol> listPage(Page page, WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
@@ -34,13 +41,13 @@
    @Override
    public boolean deleteByIds(List<Long> ids) {
        for (int i = 0; i < ids.size(); i++) {
            Long id = ids.get(i);
            WarehouseGoodsShelvesRowcol rowcol = warehouseGoodsShelvesRowcolMapper.selectById(id);
            if(rowcol.getDocumentationId()!=null && rowcol.getDocumentationId()!=0){
                log.error("货架上有商品,不能删除");
                return false;
            }
        // 3. 检查是否有商品
        Wrapper<Documentation> queryWrapper = new LambdaQueryWrapper<Documentation>()
                .in(Documentation::getWarehouseGoodsShelvesRowcolId, ids);
        List<Documentation> documentations = documentationMapper.selectList(queryWrapper);
        if (!documentations.isEmpty()) {
            log.error("货架[ID:{}]上存在商品,禁止删除", ids);
            return false;
        }
        int i = warehouseGoodsShelvesRowcolMapper.deleteBatchIds(ids);
        if(i!=ids.size()){
@@ -49,24 +56,6 @@
        }
        return true;
    }
//    @Override
//    public boolean add(WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) {
//        for (int i = 0; i < warehouseGoodsShelvesRowcol.getRow(); i++) {
//            for (int j = 0; j < warehouseGoodsShelvesRowcol.getCol(); j++) {
//                WarehouseGoodsShelvesRowcol rowcol = new WarehouseGoodsShelvesRowcol();
//                rowcol.setRow((long) i);
//                rowcol.setCol((long) j);
//                rowcol.setWarehouseGoodsShelvesId(warehouseGoodsShelvesRowcol.getWarehouseGoodsShelvesId());
//                rowcol.setWarehouseId(warehouseGoodsShelvesRowcol.getWarehouseId());
//                rowcol.setCreateUser(warehouseGoodsShelvesRowcol.getCreateUser());
//                rowcol.setCreateTime(warehouseGoodsShelvesRowcol.getCreateTime());
//                warehouseGoodsShelvesRowcolMapper.insert(rowcol);
//            }
//        }
//        return true;
//    }
}
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseGoodsShelvesServiceImpl.java
@@ -9,9 +9,12 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.warehouse.mapper.DocumentationMapper;
import com.ruoyi.warehouse.mapper.WarehouseGoodsShelvesMapper;
import com.ruoyi.warehouse.mapper.WarehouseGoodsShelvesRowcolMapper;
import com.ruoyi.warehouse.pojo.Documentation;
import com.ruoyi.warehouse.pojo.WarehouseGoodsShelvesRowcol;
import com.ruoyi.warehouse.service.DocumentationService;
import com.ruoyi.warehouse.service.WarehouseGoodsShelvesRowcolService;
import com.ruoyi.warehouse.service.WarehouseGoodsShelvesService;
import lombok.extern.slf4j.Slf4j;
@@ -41,6 +44,10 @@
    private WarehouseGoodsShelvesRowcolMapper warehouseGoodsShelvesRowcolMapper;
    @Autowired
    private WarehouseGoodsShelvesMapper warehouseGoodsShelvesMapper;
    @Autowired
    private DocumentationService documentationService;
    @Autowired
    private DocumentationMapper documentationMapper;
    @Override
    public IPage<WarehouseGoodsShelves> listPage(Page page, WarehouseGoodsShelves warehouseGoodsShelves) {
        return warehouseGoodsShelvesMapper.listPage(page,warehouseGoodsShelves);
@@ -49,11 +56,17 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean add(WarehouseGoodsShelves warehouseGoodsShelves) {
        int insert = warehouseGoodsShelvesMapper.insert(warehouseGoodsShelves);
        if (insert <= 0) {
            log.error("货架主记录添加失败");
            return false;
        WarehouseGoodsShelves one = warehouseGoodsShelvesMapper.selectOne(new LambdaQueryWrapper<WarehouseGoodsShelves>().eq(WarehouseGoodsShelves::getId, warehouseGoodsShelves.getId()));
        // 1. 检查货架名称是否已存在
        if (one == null) {
            log.error("货架ID不存在");
            int insert = warehouseGoodsShelvesMapper.insert(warehouseGoodsShelves);
            if (insert <= 0) {
                log.error("货架主记录添加失败");
                return false;
            }
        }
        Long shelvesId = warehouseGoodsShelves.getId();
        Long warehouseId = warehouseGoodsShelves.getWarehouseId();
        // 3. 批量创建行列记录
@@ -91,52 +104,38 @@
     * @return 是否更新成功
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateRowcolById(WarehouseGoodsShelves warehouseGoodsShelves) {
        // 提取关键ID,减少重复调用
        Long shelvesId = warehouseGoodsShelves.getId();
        Long warehouseId = warehouseGoodsShelves.getWarehouseId();
        // 构建查询条件:查询该货架下的所有行列记录
        Wrapper<WarehouseGoodsShelvesRowcol> queryWrapper = new LambdaQueryWrapper<WarehouseGoodsShelvesRowcol>()
                .eq(WarehouseGoodsShelvesRowcol::getWarehouseGoodsShelvesId, shelvesId);
        List<WarehouseGoodsShelvesRowcol> rowcolList = warehouseGoodsShelvesRowcolService.list(queryWrapper);
        //获得rowcolList中所有的Id
        List<Long> rowcolIds = rowcolList.stream()
                .map(WarehouseGoodsShelvesRowcol::getId)
                .collect(Collectors.toList());
        // 3. 检查是否有商品
        Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
                .in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
        List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
        if (!documentations.isEmpty()) {
            log.error("货架[ID:{}]上存在商品,禁止更新", shelvesId);
            return false;
        }
        // 先更新货架主信息
        boolean isShelvesUpdated = updateById(warehouseGoodsShelves);
        if (!isShelvesUpdated) {
            log.warn("货架[{}]主信息更新失败", shelvesId);
            return false;
        }
        // 构建查询条件:查询该货架下的所有行列记录
        WarehouseGoodsShelvesRowcol queryRowcol = new WarehouseGoodsShelvesRowcol();
        queryRowcol.setWarehouseGoodsShelvesId(shelvesId);
        queryRowcol.setWarehouseId(warehouseId);
        IPage<WarehouseGoodsShelvesRowcol> rowcolPage = warehouseGoodsShelvesRowcolService.listPage(new Page<>(), queryRowcol);
        List<WarehouseGoodsShelvesRowcol> oldRowcolList = rowcolPage.getRecords();
        // 如果没有旧的行列记录,直接添加新记录
        if (oldRowcolList.isEmpty()) {
            add(warehouseGoodsShelves);
            return true;
        }
        // 检查货架上是否有商品(有商品则不允许更新)
        boolean hasGoodsOnShelves = oldRowcolList.stream()
                .anyMatch(rowcol -> rowcol.getDocumentationId() != null);
        if (hasGoodsOnShelves) {
            log.error("货架[{}]上存在商品,不允许更新行列信息", shelvesId);
            return false;
        }
        // 提取旧行列记录的ID集合,用于删除操作
        List<Long> oldRowcolIds = oldRowcolList.stream()
                .map(WarehouseGoodsShelvesRowcol::getId)
                .collect(Collectors.toList());
        // 删除旧的行列记录
        boolean isOldRowcolRemoved = warehouseGoodsShelvesRowcolService.removeByIds(oldRowcolIds);
        boolean isOldRowcolRemoved = warehouseGoodsShelvesRowcolService.removeByIds(rowcolIds);
        if (!isOldRowcolRemoved) {
            log.error("货架[{}]的旧行列记录删除失败", shelvesId);
            return false;
        }
        // 添加新的行列记录
        add(warehouseGoodsShelves);
        log.info("货架[{}]的行列信息更新成功", shelvesId);
@@ -148,6 +147,7 @@
     * @return 是否删除成功
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteByIds(List<Long> ids) {
        // 1. 先查询所有要删除的货架信息
        List<WarehouseGoodsShelves> shelvesList = warehouseGoodsShelvesMapper.selectBatchIds(ids);
@@ -159,21 +159,23 @@
        // 2. 检查所有货架是否存在商品(有商品则不允许删除)
        for (WarehouseGoodsShelves shelves : shelvesList) {
            Long shelvesId = shelves.getId();
            Long warehouseId = shelves.getWarehouseId();
            // 构建查询条件:查询当前货架的所有行列记录
            Wrapper<WarehouseGoodsShelvesRowcol> queryWrapper = new LambdaQueryWrapper<WarehouseGoodsShelvesRowcol>()
                    .eq(WarehouseGoodsShelvesRowcol::getWarehouseGoodsShelvesId, shelvesId)
                    .eq(WarehouseGoodsShelvesRowcol::getWarehouseId, warehouseId);
                    .eq(WarehouseGoodsShelvesRowcol::getWarehouseGoodsShelvesId, shelvesId);
            // 查询行列记录(仅需判断是否有商品,无需分页)
            List<WarehouseGoodsShelvesRowcol> rowcolList = warehouseGoodsShelvesRowcolService.list(queryWrapper);
            // 检查是否有商品
            boolean hasGoods = rowcolList.stream()
                    .anyMatch(rowcol -> rowcol.getDocumentationId() != null && rowcol.getDocumentationId()!=0);
            if (hasGoods) {
            if (CollectionUtils.isEmpty(rowcolList)) {
                continue; // 无关联记录,跳过检查
            }
            //获得rowcolList中所有的Id
            List<Long> rowcolIds = rowcolList.stream()
                    .map(WarehouseGoodsShelvesRowcol::getId)
                    .collect(Collectors.toList());
            // 3. 检查是否有商品
            Wrapper<Documentation> queryWrapper1 = new LambdaQueryWrapper<Documentation>()
                    .in(Documentation::getWarehouseGoodsShelvesRowcolId, rowcolIds);
            List<Documentation> documentations = documentationMapper.selectList(queryWrapper1);
            if (!documentations.isEmpty()) {
                log.error("货架[ID:{}]上存在商品,禁止删除", shelvesId);
                return false; // 任一货架有商品则终止删除
            }
src/main/java/com/ruoyi/warehouse/service/impl/WarehouseServiceImpl.java
@@ -1,10 +1,13 @@
package com.ruoyi.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.warehouse.mapper.WarehouseMapper;
import com.ruoyi.warehouse.pojo.Warehouse;
import com.ruoyi.warehouse.pojo.WarehouseGoodsShelves;
@@ -13,9 +16,11 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Array;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author 86151
@@ -36,18 +41,35 @@
        return warehouseMapper.listPage( warehouse);
    }
//    @Override
//    public boolean deleteByIds(List<Long> ids) {
//
//        for (Long id : ids) {
//            List<WarehouseGoodsShelves> list = warehouseGoodsShelvesService.list(new QueryWrapper<WarehouseGoodsShelves>().lambda()
//                    .eq(WarehouseGoodsShelves::getWarehouseId, id));
//            if(list.size()>0){
//                log.error("仓库下有货架,不能删除 重新选择");
//                return false;
//            }
//        }
//        return removeByIds(ids);
//    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteByIds(List<Long> ids) {
        for (Long id : ids) {
            List<WarehouseGoodsShelves> list = warehouseGoodsShelvesService.list(new QueryWrapper<WarehouseGoodsShelves>().lambda()
                    .eq(WarehouseGoodsShelves::getWarehouseId, id));
            if(list.size()>0){
                log.error("仓库下有货架,不能删除 重新选择");
                return false;
            }
        // 1. 检查是否有货架
        Wrapper<WarehouseGoodsShelves> queryWrapper = new LambdaQueryWrapper<WarehouseGoodsShelves>()
                .in(WarehouseGoodsShelves::getWarehouseId, ids);
        List<WarehouseGoodsShelves> shelvesList = warehouseGoodsShelvesService.list(queryWrapper);
        //获得shelvesList中所有的Id
        List<Long> shelvesIds = shelvesList.stream().map(WarehouseGoodsShelves::getId).collect(Collectors.toList());
        // 2. 删除货架
        if (!shelvesIds.isEmpty()) {
            warehouseGoodsShelvesService.deleteByIds(shelvesIds);
        }
        return removeByIds(ids);
    }
}