1.商品查询库存不准确问题
This commit is contained in:
@@ -51,7 +51,7 @@ public interface TbProductSkuMapper {
|
|||||||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
|
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
|
||||||
int decrStockUnCheck(String id, int num);
|
int decrStockUnCheck(String id, int num);
|
||||||
|
|
||||||
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id}")
|
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id} and is_del=0")
|
||||||
List<TbProductSku> selectByProductCheckGrounding(@Param("id") Integer id);
|
List<TbProductSku> selectByProductCheckGrounding(@Param("id") Integer id);
|
||||||
|
|
||||||
@Select("select * from tb_product_sku where is_grounding=1 and is_del=0 and product_id=#{id}")
|
@Select("select * from tb_product_sku where is_grounding=1 and is_del=0 and product_id=#{id}")
|
||||||
@@ -62,4 +62,7 @@ public interface TbProductSkuMapper {
|
|||||||
|
|
||||||
@Update("update tb_product_sku set stock_number=#{stock} where product_id=#{skuId} and shop_id=#{shopId}")
|
@Update("update tb_product_sku set stock_number=#{stock} where product_id=#{skuId} and shop_id=#{shopId}")
|
||||||
int updateStock(@Param("shopId") Integer shopId, @Param("skuId") Integer skuId, @Param("stock") Integer stock);
|
int updateStock(@Param("shopId") Integer shopId, @Param("skuId") Integer skuId, @Param("stock") Integer stock);
|
||||||
|
|
||||||
|
@Select("select * from tb_product_sku where product_id=#{id} and is_del=0")
|
||||||
|
List<TbProductSku> selectByProductId(Integer id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,17 @@ public class ProductService {
|
|||||||
|
|
||||||
// 查询sku信息
|
// 查询sku信息
|
||||||
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
|
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
|
||||||
|
List<TbProductSku> skus = tbProductSkuMapper.selectByProductId(it.getId());
|
||||||
|
if (it.getIsDistribute() == 0) {
|
||||||
|
int num = 0;
|
||||||
|
for (TbProductSku item : skus) {
|
||||||
|
num += item.getStockNumber();
|
||||||
|
}
|
||||||
|
it.setStockNumber(num);
|
||||||
|
}
|
||||||
it.setSkuList(skuWithBLOBs);
|
it.setSkuList(skuWithBLOBs);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||||
|
|||||||
Reference in New Issue
Block a user