瀏覽代碼

商品详情修改

Aslee 4 年之前
父節點
當前提交
409ed0698b

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

@@ -88,4 +88,8 @@ public interface ProductModuleDao {
     List<SeconHandProduct> getSecondHandProductListByMaturity(@Param("beforeDays")Date beforeDays);
 
     void updateProductValidFlag(@Param("productID")Integer productID, @Param("validFlag")String validFlag);
+
+    String findTypeName(Integer tinyTypeID);
+
+    BrandVo getBrand(Integer brandID);
 }

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

@@ -230,6 +230,14 @@ public class ProductModuleServiceImpl implements ProductModuleService {
         //价格等级
         String priceGrade = ProductUtils.getPriceGrade(product.getPrice1());
         product.setPrice1Grade(priceGrade);
+        //商品分类
+        String typeName = productModuleDao.findTypeName(product.getTinyTypeID());
+        product.setTypeName(typeName);
+        //品牌名称
+        BrandVo brand = productModuleDao.getBrand(product.getBrandID());
+        if (null != brand) {
+            product.setBrandName(brand.getName());
+        }
         return product;
     }
 

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

@@ -502,4 +502,19 @@
             AND cshd.onLineDate  <![CDATA[  <  ]]>  #{beforeDays}
 
     </select>
+
+    <select id="findTypeName" resultType="java.lang.String">
+        SELECT
+          CONCAT(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
+        WHERE
+          tinyTypeID = #{tinyTypeID}
+    </select>
+
+    <select id="getBrand" resultType="com.caimei.module.base.entity.vo.BrandVo">
+        SELECT * FROM cm_brand WHERE id = #{brandID}
+    </select>
 </mapper>