|
@@ -1,5 +1,6 @@
|
|
package io.github.nnkwrik.goodsservice.service.impl;
|
|
package io.github.nnkwrik.goodsservice.service.impl;
|
|
|
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
import io.github.nnkwrik.goodsservice.dao.CategoryMapper;
|
|
import io.github.nnkwrik.goodsservice.dao.CategoryMapper;
|
|
import io.github.nnkwrik.goodsservice.dao.GoodsMapper;
|
|
import io.github.nnkwrik.goodsservice.dao.GoodsMapper;
|
|
import io.github.nnkwrik.goodsservice.dao.OtherMapper;
|
|
import io.github.nnkwrik.goodsservice.dao.OtherMapper;
|
|
@@ -13,7 +14,7 @@ import io.github.nnkwrik.goodsservice.model.vo.inner.BannerVo;
|
|
import io.github.nnkwrik.goodsservice.model.vo.inner.CategoryVo;
|
|
import io.github.nnkwrik.goodsservice.model.vo.inner.CategoryVo;
|
|
import io.github.nnkwrik.goodsservice.model.vo.inner.ChannelVo;
|
|
import io.github.nnkwrik.goodsservice.model.vo.inner.ChannelVo;
|
|
import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsSimpleVo;
|
|
import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsSimpleVo;
|
|
-import io.github.nnkwrik.goodsservice.service.CatalogService;
|
|
|
|
|
|
+import io.github.nnkwrik.goodsservice.service.IndexService;
|
|
import io.github.nnkwrik.goodsservice.util.PO2VO;
|
|
import io.github.nnkwrik.goodsservice.util.PO2VO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -25,7 +26,7 @@ import java.util.List;
|
|
* @date 18/11/16 15:23
|
|
* @date 18/11/16 15:23
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
-public class CatalogServiceImpl implements CatalogService {
|
|
|
|
|
|
+public class IndexServiceImpl implements IndexService {
|
|
@Autowired
|
|
@Autowired
|
|
private CategoryMapper categoryMapper;
|
|
private CategoryMapper categoryMapper;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -37,15 +38,16 @@ public class CatalogServiceImpl implements CatalogService {
|
|
public IndexVO getIndex() {
|
|
public IndexVO getIndex() {
|
|
//广告
|
|
//广告
|
|
List<Ad> adList = otherMapper.findAd();
|
|
List<Ad> adList = otherMapper.findAd();
|
|
- List<BannerVo> bannerVoList = PO2VO.convertList(PO2VO.Banner, adList);
|
|
|
|
|
|
+ List<BannerVo> bannerVoList = PO2VO.convertList(PO2VO.banner, adList);
|
|
|
|
|
|
//分类
|
|
//分类
|
|
List<Channel> channelList = otherMapper.findChannel();
|
|
List<Channel> channelList = otherMapper.findChannel();
|
|
- List<ChannelVo> channelVoList = PO2VO.convertList(PO2VO.Channel, channelList);
|
|
|
|
|
|
+ List<ChannelVo> channelVoList = PO2VO.convertList(PO2VO.channel, channelList);
|
|
|
|
|
|
//推荐商品
|
|
//推荐商品
|
|
|
|
+ PageHelper.startPage(1, 10);
|
|
List<Goods> goodsList = goodsMapper.findSimpleGoods();
|
|
List<Goods> goodsList = goodsMapper.findSimpleGoods();
|
|
- List<GoodsSimpleVo> goodsSimpleVOList = PO2VO.convertList(PO2VO.GoodsSimple, goodsList);
|
|
|
|
|
|
+ List<GoodsSimpleVo> goodsSimpleVOList = PO2VO.convertList(PO2VO.goodsSimple, goodsList);
|
|
|
|
|
|
return new IndexVO(goodsSimpleVOList, bannerVoList, channelVoList);
|
|
return new IndexVO(goodsSimpleVOList, bannerVoList, channelVoList);
|
|
}
|
|
}
|
|
@@ -57,8 +59,8 @@ public class CatalogServiceImpl implements CatalogService {
|
|
List<Category> subCategory = categoryMapper.findSubCategory(currentCate.getId());
|
|
List<Category> subCategory = categoryMapper.findSubCategory(currentCate.getId());
|
|
|
|
|
|
|
|
|
|
- List<CategoryVo> mainCategoryVo = PO2VO.convertList(PO2VO.Category, mainCategory);
|
|
|
|
- List<CategoryVo> subCategoryVo = PO2VO.convertList(PO2VO.Category, subCategory);
|
|
|
|
|
|
+ List<CategoryVo> mainCategoryVo = PO2VO.convertList(PO2VO.category, mainCategory);
|
|
|
|
+ List<CategoryVo> subCategoryVo = PO2VO.convertList(PO2VO.category, subCategory);
|
|
CategoryVo currentCategoryVo =
|
|
CategoryVo currentCategoryVo =
|
|
new CategoryVo(currentCate.getId(), currentCate.getName(), currentCate.getIconUrl(), subCategoryVo);
|
|
new CategoryVo(currentCate.getId(), currentCate.getName(), currentCate.getIconUrl(), subCategoryVo);
|
|
|
|
|
|
@@ -68,9 +70,9 @@ public class CatalogServiceImpl implements CatalogService {
|
|
@Override
|
|
@Override
|
|
public CatalogVo getCatalogById(int id) {
|
|
public CatalogVo getCatalogById(int id) {
|
|
List<Category> subCategory = categoryMapper.findSubCategory(id);
|
|
List<Category> subCategory = categoryMapper.findSubCategory(id);
|
|
- List<CategoryVo> subCategoryVo = PO2VO.convertList(PO2VO.Category, subCategory);
|
|
|
|
|
|
+ List<CategoryVo> subCategoryVo = PO2VO.convertList(PO2VO.category, subCategory);
|
|
Category currentCategory = categoryMapper.findCategoryById(id);
|
|
Category currentCategory = categoryMapper.findCategoryById(id);
|
|
- CategoryVo currentCategoryVo = PO2VO.convert(PO2VO.Category, currentCategory);
|
|
|
|
|
|
+ CategoryVo currentCategoryVo = PO2VO.convert(PO2VO.category, currentCategory);
|
|
currentCategoryVo.setSubCategoryList(subCategoryVo);
|
|
currentCategoryVo.setSubCategoryList(subCategoryVo);
|
|
|
|
|
|
return new CatalogVo(null, currentCategoryVo);
|
|
return new CatalogVo(null, currentCategoryVo);
|