Przeglądaj źródła

商品详情分类名获取

Aslee 4 lat temu
rodzic
commit
4616efed49

+ 1 - 1
product/src/main/java/com/caimei/module/product/dao/ProductModuleDao.java

@@ -89,7 +89,7 @@ public interface ProductModuleDao {
 
     void updateProductValidFlag(@Param("productID")Integer productID, @Param("validFlag")String validFlag);
 
-    String findTypeName(Integer tinyTypeID);
+    String findTypeName(@Param("bigTypeID")Integer bigTypeID, @Param("smallTypeID")Integer smallTypeID, @Param("tinyTypeID")Integer tinyTypeID);
 
     BrandVo getBrand(Integer brandID);
 

+ 1 - 1
product/src/main/java/com/caimei/module/product/service/impl/ProductModuleServiceImpl.java

@@ -347,7 +347,7 @@ public class ProductModuleServiceImpl implements ProductModuleService {
         String priceGrade = ProductUtils.getPriceGrade(product.getPrice1());
         product.setPrice1Grade(priceGrade);
         //商品分类
-        String typeName = productModuleDao.findTypeName(product.getTinyTypeID());
+        String typeName = productModuleDao.findTypeName(product.getBigTypeID(),product.getSmallTypeID(), product.getTinyTypeID());
         product.setTypeName(typeName);
         //品牌名称
         BrandVo brand = productModuleDao.getBrand(product.getBrandID());

+ 5 - 5
product/src/main/resources/com-caimei-module-product/ProductModuleMapper.xml

@@ -558,13 +558,13 @@
 
     <select id="findTypeName" resultType="java.lang.String">
         SELECT
-          CONCAT(b.name, "-", s.name, "-", t.name)
+          CONCAT_WS("-", b.name,s.name, t.name)
         FROM
-          tinytype t
-          LEFT JOIN smalltype s ON t.smallTypeID = s.smallTypeID
-          LEFT JOIN bigtype b ON s.bigTypeID = b.bigTypeID
+          bigtype b
+          LEFT JOIN smalltype s ON s.smallTypeID = #{smallTypeID}
+          LEFT JOIN tinytype t ON t.tinyTypeID = #{tinyTypeID}
         WHERE
-          tinyTypeID = #{tinyTypeID}
+          b.bigTypeID = #{bigTypeID};
     </select>
 
     <select id="getBrand" resultType="com.caimei.module.base.entity.vo.BrandVo">