deb
This commit is contained in:
parent
634b62cd43
commit
717bc87db2
|
|
@ -48,13 +48,14 @@ public class InventoryController extends BaseController {
|
|||
@RequestMapping("/getByGoodsId")
|
||||
public Result<Map<String, Object>> getByGoodsId() {
|
||||
int goodsId = parmsUtil.getInteger("goodsId", "请输入商品ID");
|
||||
Boolean isZero = parmsUtil.getObject("isZero", Boolean.class);
|
||||
|
||||
Goods goods = goodsService.getById(goodsId);
|
||||
if (goods == null) {
|
||||
return error("商品不存在");
|
||||
}
|
||||
Map<String, Object> goodsMap = JSON.parseObject(JSON.toJSONString(goods), Map.class);
|
||||
List<Inventory> list = inventoryService.getListByGoodsId(goodsId);
|
||||
List<Inventory> list = inventoryService.getListByGoodsId(goodsId,isZero);
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
for (Inventory inventory : list) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
|
@ -84,7 +85,7 @@ public class InventoryController extends BaseController {
|
|||
if (goods == null) {
|
||||
return error("商品不存在");
|
||||
}
|
||||
List<Inventory> list = inventoryService.getListByGoodsId(goodsId);
|
||||
List<Inventory> list = inventoryService.getListByGoodsId(goodsId,true);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,10 +112,12 @@ public class InventoryService extends BaseService {
|
|||
/**
|
||||
* 根据goodsId 获取该goods的所有库存信息
|
||||
*/
|
||||
public List<Inventory> getListByGoodsId(int goodsId) {
|
||||
public List<Inventory> getListByGoodsId(int goodsId,boolean isZero) {
|
||||
QueryWrapper<Inventory> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("good_id", goodsId);
|
||||
if (!isZero){
|
||||
queryWrapper.and(wrapper->wrapper.ne("whole_number", 0).or().ne("fragment_number", 0));
|
||||
}
|
||||
queryWrapper.orderByDesc("create_datetime");
|
||||
return inventoryMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue