|
@@ -1,6 +1,7 @@
|
|
|
package com.hwrj.cloud.admin.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.hwrj.cloud.admin.dao.PmsProductCategoryAttributeRelationDao;
|
|
|
import com.hwrj.cloud.admin.dao.PmsProductCategoryDao;
|
|
|
import com.hwrj.cloud.admin.dto.PmsProductCategoryParam;
|
|
@@ -94,13 +95,21 @@ public class PmsProductCategoryServiceImpl implements PmsProductCategoryService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum) {
|
|
|
+ public PageInfo<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum) {
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
PmsProductCategoryExample example = new PmsProductCategoryExample();
|
|
|
- example.setOrderByClause("sort desc");
|
|
|
- example.setOrderByClause("id desc");
|
|
|
+ example.setOrderByClause("sort asc");
|
|
|
example.createCriteria().andParentIdEqualTo(parentId);
|
|
|
- return productCategoryMapper.selectByExample(example);
|
|
|
+ List<PmsProductCategory> pmsProductCategories = productCategoryMapper.selectByExample(example);
|
|
|
+ PageInfo<PmsProductCategory> pageInfo = new PageInfo(pmsProductCategories);
|
|
|
+
|
|
|
+ List<PmsProductCategory> list = pageInfo.getList();
|
|
|
+ for (PmsProductCategory pmsProductCategory : list) {
|
|
|
+
|
|
|
+ Integer productNum = productCategoryDao.ProductNum(parentId,pmsProductCategory.getId());
|
|
|
+ pmsProductCategory.setProductCount(productNum);
|
|
|
+ }
|
|
|
+ return pageInfo;
|
|
|
}
|
|
|
@Autowired
|
|
|
private PmsProductCategoryDao pmsProductCategoryDao;
|