|
|
|
|
@ -4,6 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.move.ErpStockMovePageReqVO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductCategoryDO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveDO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockMoveItemDO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockRecordDO;
|
|
|
|
|
@ -33,14 +35,19 @@ public interface ErpStockMoveMapper extends BaseMapperX<ErpStockMoveDO> {
|
|
|
|
|
.orderByDesc(ErpStockMoveDO::getId);
|
|
|
|
|
if (reqVO.getFromWarehouseId() != null || reqVO.getFromAreaId() != null
|
|
|
|
|
|| reqVO.getToWarehouseId() != null || reqVO.getToAreaId() != null
|
|
|
|
|
|| reqVO.getProductId() != null) {
|
|
|
|
|
|| reqVO.getProductId() != null || reqVO.getCategoryType() != null) {
|
|
|
|
|
query.leftJoin(ErpStockMoveItemDO.class, ErpStockMoveItemDO::getMoveId, ErpStockMoveDO::getId)
|
|
|
|
|
.eq(reqVO.getFromWarehouseId() != null, ErpStockMoveItemDO::getFromWarehouseId, reqVO.getFromWarehouseId())
|
|
|
|
|
.eq(reqVO.getFromAreaId() != null, ErpStockMoveItemDO::getFromAreaId, reqVO.getFromAreaId())
|
|
|
|
|
.eq(reqVO.getToWarehouseId() != null, ErpStockMoveItemDO::getToWarehouseId, reqVO.getToWarehouseId())
|
|
|
|
|
.eq(reqVO.getToAreaId() != null, ErpStockMoveItemDO::getToAreaId, reqVO.getToAreaId())
|
|
|
|
|
.eq(reqVO.getProductId() != null, ErpStockMoveItemDO::getProductId, reqVO.getProductId())
|
|
|
|
|
.groupBy(ErpStockMoveDO::getId); // 避免 1 对多查询,产生相同的 1
|
|
|
|
|
.eq(reqVO.getProductId() != null, ErpStockMoveItemDO::getProductId, reqVO.getProductId());
|
|
|
|
|
if (reqVO.getCategoryType() != null) {
|
|
|
|
|
query.leftJoin(ErpProductDO.class, ErpProductDO::getId, ErpStockMoveItemDO::getProductId)
|
|
|
|
|
.leftJoin(ErpProductCategoryDO.class, ErpProductCategoryDO::getId, ErpProductDO::getCategoryId)
|
|
|
|
|
.eq(ErpProductCategoryDO::getType, reqVO.getCategoryType());
|
|
|
|
|
}
|
|
|
|
|
query.groupBy(ErpStockMoveDO::getId); // 避免 1 对多查询,产生相同的 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|