Kaynağa Gözat

分类排序

Aslee 4 yıl önce
ebeveyn
işleme
7deab5bbd7

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

@@ -44,8 +44,8 @@ public class ProductModuleServiceImpl implements ProductModuleService {
             String caiMeiImage = ProductUtils.getImageURL("caiMeiImage", null, 0, domain);
             bigType.setWwwIcon(StringUtils.isEmpty(bigType.getWwwIcon())?caiMeiImage:bigType.getWwwIcon());
             bigType.setCrmIcon(StringUtils.isEmpty(bigType.getCrmIcon())?caiMeiImage:bigType.getCrmIcon());
-            List<SmalltypeVo> SmalltypeList = productModuleDao.getSmallType(bigType.getBigTypeID(), source);
-            for (SmalltypeVo smalltype : SmalltypeList) {
+            List<SmalltypeVo> smalltypeList = productModuleDao.getSmallType(bigType.getBigTypeID(), source);
+            for (SmalltypeVo smalltype : smalltypeList) {
                 smalltype.setWwwIcon(StringUtils.isEmpty(smalltype.getWwwIcon())?caiMeiImage:smalltype.getWwwIcon());
                 smalltype.setCrmIcon(StringUtils.isEmpty(smalltype.getCrmIcon())?caiMeiImage:smalltype.getCrmIcon());
                 List<TinytypeVo> tinytypeList = productModuleDao.getTinytype(smalltype.getSmallTypeID(), source);
@@ -57,7 +57,9 @@ public class ProductModuleServiceImpl implements ProductModuleService {
                     smalltype.setTinytypeList(tinytypeList);
                 }
             }
-            bigType.setSmalltypeList(SmalltypeList);
+            if (!CollectionUtils.isEmpty(smalltypeList)) {
+                bigType.setSmalltypeList(smalltypeList);
+            }
         }
         return bigTypeList;
     }

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

@@ -69,6 +69,7 @@
             <if test="source == 'crm'.toString()">
                 and crmValidFlag = '1'
             </if>
+        order by sortIndex
     </select>
     <select id="getSmallType" resultType="com.caimei.module.base.entity.vo.SmalltypeVo">
         select
@@ -81,6 +82,7 @@
         <if test="source == 'crm'.toString()">
             and crmValidFlag = '1'
         </if>
+        order by sortIndex
     </select>
     <select id="getTinytype" resultType="com.caimei.module.base.entity.vo.TinytypeVo">
         select
@@ -93,6 +95,7 @@
         <if test="source == 'crm'.toString()">
             and crmValidFlag = '1'
         </if>
+        order by sortIndex
     </select>
     <!-- sortType (3:价格升序, 4:价格降序, 7:人气, 8:销量) -->
     <select id="getProductsByTypeId" resultType="com.caimei.module.base.entity.vo.ProductVo" parameterType="java.lang.Integer">