Browse Source

卖家中心查询物料总数方法改为根据索引查询。

dongbw 7 years ago
parent
commit
87dacabb77

+ 3 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -1600,8 +1600,9 @@ public class ProductServiceImpl implements ProductService {
             standard = v_productPersonDao.getCountByEnuuAndUserUUAndStatusAndEnabled(enUU, userUU, ShortConstant.YES_SHORT, IntegerConstant.YES_SHORT);
             nStandard = v_productPersonDao.getCountByEnuuAndUserUUAndStatusAndEnabled(enUU, userUU, ShortConstant.NO_SHORT, IntegerConstant.YES_SHORT);
         } else {
-            standard = productDao.getCountByEnuuAndStatusAndEnabled(enUU, ShortConstant.YES_SHORT, IntegerConstant.YES_SHORT);
-            nStandard = productDao.getCountByEnuuAndStatusAndEnabled(enUU, ShortConstant.NO_SHORT, IntegerConstant.YES_SHORT);
+            // 数据量大时,从数据库查询数量也变得很慢,所以改用查索引获取 dongbw 2018年5月28日 11:24:17
+            standard = (int) searchService.getProducts(enUU, null, 1, 10, "standard").getTotalElement();
+            nStandard = (int) searchService.getProducts(enUU, null, 1, 10, "nStandard").getTotalElement();
         }
         resultMap.put("standard", standard);
         resultMap.put("nStandard", nStandard);