Selaa lähdekoodia

商品详情阶梯价格

chao 4 vuotta sitten
vanhempi
commit
a4fa894b95

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

@@ -189,7 +189,7 @@ public class PriceUtilService {
         product.setUserIdentity(price.getUserIdentity());
         product.setUserIdentity(price.getUserIdentity());
         product.setRepurchaseFlag(price.getRepurchaseFlag());
         product.setRepurchaseFlag(price.getRepurchaseFlag());
         product.setMaxBuyNumber(price.getMaxBuyNumber());
         product.setMaxBuyNumber(price.getMaxBuyNumber());
-        List<LadderPriceVo> ladderPrices = priceMapper.getladderPricesByProductId(product.getProductId());
+        List<LadderPriceVo> ladderPrices = priceMapper.getLadderPricesByProductId(product.getProductId());
         TaxVo tax = priceMapper.getTaxByProductId(product.getProductId());
         TaxVo tax = priceMapper.getTaxByProductId(product.getProductId());
         if (!CollectionUtils.isEmpty(ladderPrices)) {
         if (!CollectionUtils.isEmpty(ladderPrices)) {
             setLadderPriceList(ladderPrices, tax);
             setLadderPriceList(ladderPrices, tax);

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

@@ -31,7 +31,7 @@ public interface PriceMapper {
     /**
     /**
      * 根据商品ID查询阶梯价列表
      * 根据商品ID查询阶梯价列表
      */
      */
-    List<LadderPriceVo> getladderPricesByProductId(Integer productId);
+    List<LadderPriceVo> getLadderPricesByProductId(Integer productId);
     /**
     /**
      * 获取最低阶梯价(价格最低,阶梯数最大)
      * 获取最低阶梯价(价格最低,阶梯数最大)
      */
      */

+ 4 - 0
src/main/java/com/caimei365/commodity/model/vo/ProductDetailVo.java

@@ -95,6 +95,10 @@ public class ProductDetailVo implements Serializable {
      * 启用阶梯价格标识 0否 1是
      * 启用阶梯价格标识 0否 1是
      */
      */
     private Integer ladderPriceFlag;
     private Integer ladderPriceFlag;
+    /**
+     * 阶梯价格列表
+     */
+    private List<LadderPriceVo> ladderPriceList;
     /**
     /**
      * 成本价
      * 成本价
      */
      */

+ 5 - 0
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -344,6 +344,11 @@ public class PageServiceImpl implements PageService {
             product.setUserIdentity(price.getUserIdentity());
             product.setUserIdentity(price.getUserIdentity());
             product.setRepurchaseFlag(price.getRepurchaseFlag());
             product.setRepurchaseFlag(price.getRepurchaseFlag());
             product.setMaxBuyNumber(price.getMaxBuyNumber());
             product.setMaxBuyNumber(price.getMaxBuyNumber());
+            // 设置阶梯价格详情
+            if (1 == price.getLadderPriceFlag()) {
+                List<LadderPriceVo> ladderPrices = priceMapper.getLadderPricesByProductId(product.getProductId());
+                product.setLadderPriceList(ladderPrices);
+            }
         }
         }
         return ResponseJson.success(product);
         return ResponseJson.success(product);
     }
     }

+ 1 - 1
src/main/java/com/caimei365/commodity/service/impl/PriceServiceImpl.java

@@ -86,7 +86,7 @@ public class PriceServiceImpl implements PriceService {
      */
      */
     @Override
     @Override
     public ResponseJson<List<LadderPriceVo>> getLadderPrice(Integer productId) {
     public ResponseJson<List<LadderPriceVo>> getLadderPrice(Integer productId) {
-        List<LadderPriceVo> ladderPrices = priceMapper.getladderPricesByProductId(productId);
+        List<LadderPriceVo> ladderPrices = priceMapper.getLadderPricesByProductId(productId);
         TaxVo tax = priceMapper.getTaxByProductId(productId);
         TaxVo tax = priceMapper.getTaxByProductId(productId);
         if (!CollectionUtils.isEmpty(ladderPrices)) {
         if (!CollectionUtils.isEmpty(ladderPrices)) {
             priceUtilService.setLadderPriceList(ladderPrices, tax);
             priceUtilService.setLadderPriceList(ladderPrices, tax);

+ 0 - 1
src/main/java/com/caimei365/commodity/service/impl/ShopServiceImpl.java

@@ -20,7 +20,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;

+ 1 - 1
src/main/resources/mapper/PriceMapper.xml

@@ -49,7 +49,7 @@
               #{productId}
               #{productId}
           </foreach>
           </foreach>
     </select>
     </select>
-    <select id="getladderPricesByProductId" resultType="com.caimei365.commodity.model.vo.LadderPriceVo">
+    <select id="getLadderPricesByProductId" resultType="com.caimei365.commodity.model.vo.LadderPriceVo">
         select
         select
         	id, productId, ladderNum, buyNum, buyPrice
         	id, productId, ladderNum, buyNum, buyPrice
         from product_ladder_price
         from product_ladder_price