no message
parent
70692c511a
commit
ee6370447c
|
|
@ -94,6 +94,12 @@ public class Inventory implements Serializable {
|
||||||
@Dict(dicCode = "inventory_status")
|
@Dict(dicCode = "inventory_status")
|
||||||
private java.lang.Integer status;
|
private java.lang.Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多状态查询库存
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String status_MultiString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
package org.cpte.modules.inventory.service.impl;
|
package org.cpte.modules.inventory.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.cpte.modules.base.entity.ItemKey;
|
||||||
import org.cpte.modules.base.entity.Point;
|
import org.cpte.modules.base.entity.Point;
|
||||||
import org.cpte.modules.base.entity.Stock;
|
import org.cpte.modules.base.entity.Stock;
|
||||||
|
import org.cpte.modules.base.mapper.ItemKeyMapper;
|
||||||
import org.cpte.modules.base.mapper.PointMapper;
|
import org.cpte.modules.base.mapper.PointMapper;
|
||||||
import org.cpte.modules.base.mapper.StockMapper;
|
import org.cpte.modules.base.mapper.StockMapper;
|
||||||
import org.cpte.modules.constant.enums.CommonStatusEnum;
|
import org.cpte.modules.constant.enums.CommonStatusEnum;
|
||||||
|
|
@ -39,6 +42,9 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
|
||||||
@Autowired
|
@Autowired
|
||||||
private StockMapper stockMapper;
|
private StockMapper stockMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ItemKeyMapper itemKeyMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<Inventory> selectInventoryWithItemKey(Page<Inventory> page, Inventory inventory) {
|
public IPage<Inventory> selectInventoryWithItemKey(Page<Inventory> page, Inventory inventory) {
|
||||||
QueryWrapper<Inventory> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<Inventory> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
@ -52,8 +58,20 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
|
||||||
if (oConvertUtils.isNotEmpty(inventory.getStockId())) {
|
if (oConvertUtils.isNotEmpty(inventory.getStockId())) {
|
||||||
queryWrapper.eq("inventory.stock_id", inventory.getStockId());
|
queryWrapper.eq("inventory.stock_id", inventory.getStockId());
|
||||||
}
|
}
|
||||||
if (oConvertUtils.isNotEmpty(inventory.getStatus())) {
|
if (oConvertUtils.isNotEmpty(inventory.getStatus_MultiString())) {
|
||||||
queryWrapper.eq("inventory.status", inventory.getStatus());
|
List<Integer> status = Arrays.stream(inventory.getStatus_MultiString().split(","))
|
||||||
|
.map(Integer::parseInt)
|
||||||
|
.toList();
|
||||||
|
queryWrapper.in("inventory.status", status);
|
||||||
|
}
|
||||||
|
if (oConvertUtils.isNotEmpty(inventory.getWhCode())) {
|
||||||
|
LambdaQueryWrapper<ItemKey> itemKeyQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
itemKeyQueryWrapper.eq(ItemKey::getWhCode, inventory.getWhCode());
|
||||||
|
List<ItemKey> itemKeys=itemKeyMapper.selectList(itemKeyQueryWrapper);
|
||||||
|
if(CollectionUtils.isNotEmpty(itemKeys)){
|
||||||
|
List<Long> itemKeyIds = itemKeys.stream().map(ItemKey::getId).distinct().toList();
|
||||||
|
queryWrapper.in("inventory.item_key_id", itemKeyIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseMapper.selectInventoryWithItemKey(page, inventory, queryWrapper);
|
return baseMapper.selectInventoryWithItemKey(page, inventory, queryWrapper);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue