Browse Source

fixed 更新商品初始销售量

fushengqian 3 weeks ago
parent
commit
813a0d7000

+ 2 - 1
fuint-application/src/main/java/com/fuint/common/service/GoodsService.java

@@ -117,9 +117,10 @@ public interface GoodsService {
      * 更新已售数量
      *
      * @param goodsId 商品ID
+     * @param saleNum 销售数量
      * @return
      * */
-    Boolean updateInitSale(Integer goodsId);
+    Boolean updateInitSale(Integer goodsId, Integer saleNum);
 
     /**
      * 获取选择商品列表

+ 3 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/GoodsServiceImpl.java

@@ -646,12 +646,13 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
      * 更新已售数量
      *
      * @param goodsId 商品ID
+     * @param saleNum 销售数量
      * @return
      * */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Boolean updateInitSale(Integer goodsId) {
-        return mtGoodsMapper.updateInitSale(goodsId);
+    public Boolean updateInitSale(Integer goodsId, Integer saleNum) {
+        return mtGoodsMapper.updateInitSale(goodsId, saleNum);
     }
 
     /**

+ 1 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java

@@ -1435,7 +1435,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
                                 }
                             }
                             // 将已销售数量+1
-                            goodsService.updateInitSale(mtGoods.getId());
+                            goodsService.updateInitSale(mtGoods.getId(), goodsDto.getNum());
                         }
                     }
                 }

+ 1 - 1
fuint-repository/src/main/java/com/fuint/repository/mapper/MtGoodsMapper.java

@@ -23,7 +23,7 @@ public interface MtGoodsMapper extends BaseMapper<MtGoods> {
 
     MtGoods getByGoodsNo(@Param("merchantId") Integer merchantId, @Param("goodsNo") String goodsNo);
 
-    Boolean updateInitSale(@Param("goodsId") Integer goodsId);
+    Boolean updateInitSale(@Param("goodsId") Integer goodsId, @Param("saleNum") Integer saleNum);
 
     List<GoodsBean> selectGoodsList(@Param("merchantId") Integer merchantId, @Param("storeId") Integer storeId, @Param("cateId") Integer cateId, @Param("keyword") String keyword);
 

+ 1 - 1
fuint-repository/src/main/resources/mapper/MtGoodsMapper.xml

@@ -32,7 +32,7 @@
     </select>
 
     <update id="updateInitSale">
-        update mt_goods t set t.INIT_SALE = t.INIT_SALE + 1 where t.ID = #{goodsId}
+        update mt_goods t set t.INIT_SALE = t.INIT_SALE + #{saleNum} where t.ID = #{goodsId}
     </update>
 
     <select id="selectGoodsList" resultType="com.fuint.repository.bean.GoodsBean">