diff --git a/hiver-admin/test-output/test-report.html b/hiver-admin/test-output/test-report.html index 7c187d44..ee80503b 100644 --- a/hiver-admin/test-output/test-report.html +++ b/hiver-admin/test-output/test-report.html @@ -35,7 +35,7 @@ Hiver
  • -九月 30, 2024 00:39:10 +九月 30, 2024 17:44:36
  • @@ -84,7 +84,7 @@

    passTest

    -

    00:39:10 上午 / 0.016 secs

    +

    17:44:37 下午 / 0.02 secs

    @@ -92,9 +92,9 @@
    #test-id=1
    passTest
    -09.30.2024 00:39:10 -09.30.2024 00:39:10 -0.016 secs +09.30.2024 17:44:37 +09.30.2024 17:44:37 +0.02 secs
    @@ -104,7 +104,7 @@ Pass - 0:39:10 + 17:44:37 Test passed @@ -128,13 +128,13 @@

    Started

    -

    九月 30, 2024 00:39:10

    +

    九月 30, 2024 17:44:36

    Ended

    -

    九月 30, 2024 00:39:10

    +

    九月 30, 2024 17:44:37

    diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java index 2abe582e..e02fc611 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/SaleServiceImpl.java @@ -251,9 +251,11 @@ public class SaleServiceImpl extends ServiceImpl implements Sa for (BuyCountVo buyCountVo : buyCount) { buyCountMap.put(buyCountVo.getProductId(), buyCountVo.getBuyCount()); } - for (SaleDetailDTO saleDetailDTO : sale.getSaleDetailDTOList()) { - String productId = saleDetailDTO.getProductId(); - saleDetailDTO.setBuyCount(buyCountMap.getOrDefault(productId, 0)); + if(sale != null && sale.getSaleDetailDTOList() != null){ + for (SaleDetailDTO saleDetailDTO : sale.getSaleDetailDTOList()) { + String productId = saleDetailDTO.getProductId(); + saleDetailDTO.setBuyCount(buyCountMap.getOrDefault(productId, 0)); + } } } diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml index ca6a40e3..cd40ed4a 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml @@ -575,7 +575,7 @@ t.tail_warn, t.in_storage_status, t.customer_category_rule, - COALESCE(ss.total_stock_count, 0) AS total_stock_count, + COALESCE(ss.stock_count + ss.minus_stock_count, 0) AS total_stock_count, COALESCE(ss.stock_count, 0) AS stock_count, COALESCE(ss.minus_stock_count, 0) AS minus_stock_count @@ -584,7 +584,6 @@ FROM t_product t LEFT JOIN ( SELECT - sum( s.stock_count ) AS total_stock_count, sum( CASE WHEN s.stock_count < 0 THEN 0 ELSE s.stock_count END ) AS stock_count, sum( CASE WHEN s.stock_count > 0 THEN 0 ELSE s.stock_count END ) AS minus_stock_count, shop_id, @@ -666,8 +665,13 @@ - - total_stock_count #{queryParams.order} , + + + total_stock_count desc , + + + total_stock_count asc , + t.in_storage_status asc, t.del_flag desc,t.create_time desc, id