zhijiezhao пре 2 година
родитељ
комит
364c811754

+ 5 - 3
src/main/java/com/caimei365/commodity/components/PriceUtilService.java

@@ -186,11 +186,13 @@ public class PriceUtilService {
                     List<ProductItemVo> giftList = promotionsMapper.getPromotionGifts(promotions.getId());
                     promotions.setGiftList(giftList);
                 }
-                if (promotions.getType() == 1 && promotions.getMode() == 1 && null != promotions.getTouchPrice()) {
+                if (promotions.getType() == 1 && promotions.getMode() == 1) {
+                    // 单品优惠价的时候,取当前sku的touchprice
+                    Double touchPrice=priceMapper.getTouchPriceBySku(s.getSkuId());
                     s.setOriginalPrice(s.getPrice());
                     price.setOriginalPrice(atomicDouble.get());
-                    s.setPrice(promotions.getTouchPrice());
-                    price.setPrice(promotions.getTouchPrice());
+                    s.setPrice(touchPrice);
+                    price.setPrice(touchPrice);
                 }
                 price.setPromotions(promotions);
             } else {

+ 2 - 0
src/main/java/com/caimei365/commodity/mapper/PriceMapper.java

@@ -98,4 +98,6 @@ public interface PriceMapper {
     ProductItemVo findLowPriceOfPrice(Integer productId);
 
     VipSkuPriceDto getVipSku(Integer skuId);
+
+    Double getTouchPriceBySku(Integer skuId);
 }

+ 5 - 0
src/main/resources/mapper/PriceMapper.xml

@@ -253,4 +253,9 @@
         from cm_svip_product_sku
         where skuId = #{skuId}
     </select>
+    <select id="getTouchPriceBySku" resultType="java.lang.Double">
+        select touchPrice
+        from cm_promotion_sku
+        where skuId = #{skuId}
+    </select>
 </mapper>