Răsfoiți Sursa

:first_quarter_moon_with_face: 从分类访问商品详情

nnkwrik 6 ani în urmă
părinte
comite
372e6655a7

+ 2 - 1
dev/ngrok/start.sh

@@ -1,2 +1,3 @@
 #!/usr/bin/env bash
-./ngrok http 8804
+cur_dir=`pwd`
+${cur_dir}/ngrok http 8804

+ 7 - 0
goods-service/pom.xml

@@ -59,12 +59,19 @@
             <version>1.3.1</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.10</version>
+        </dependency>
+
         <dependency>
             <groupId>io.github.nnkwrik</groupId>
             <artifactId>common</artifactId>
             <version>0.0.1-SNAPSHOT</version>
         </dependency>
 
+
     </dependencies>
 
     <dependencyManagement>

+ 38 - 20
goods-service/src/main/java/io/github/nnkwrik/goodsservice/controller/GoodsController.java

@@ -1,16 +1,21 @@
 package io.github.nnkwrik.goodsservice.controller;
 
-import io.github.nnkwrik.goodsservice.dao.CategoryMapper;
-import io.github.nnkwrik.goodsservice.model.vo.CatalogVo;
-import io.github.nnkwrik.goodsservice.model.vo.IndexVO;
+import io.github.nnkwrik.goodsservice.model.vo.CategoryPageVo;
+import io.github.nnkwrik.goodsservice.model.vo.GoodsDetailPageVo;
 import io.github.nnkwrik.goodsservice.model.vo.ResponseVO;
-import io.github.nnkwrik.goodsservice.service.CatalogService;
+import io.github.nnkwrik.goodsservice.model.vo.inner.CategoryVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GalleryVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsDetailVo;
+import io.github.nnkwrik.goodsservice.service.GoodsService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * @author nnkwrik
  * @date 18/11/14 18:42
@@ -20,35 +25,48 @@ import org.springframework.web.bind.annotation.RestController;
 public class GoodsController {
 
     @Autowired
-    private CatalogService catalogService;
+    private GoodsService goodsService;
 
-    @GetMapping("/index/index")
-    public ResponseVO<IndexVO> index() {
+    /**
+     * 获取选定的子目录下的商品列表和同一个父目录下的兄弟目录
+     *
+     * @param categoryId
+     * @return
+     */
+    @GetMapping("/goods/category/{categoryId}")
 
-        IndexVO vo = catalogService.getIndex();
-        log.debug("浏览首页 : 广告 = {},分类 = {}, 商品 = {}", vo.getBanner(), vo.getChannel(), vo.getIndexGoodsList());
+    public ResponseVO<CategoryVo> getCategoryPage(@PathVariable("categoryId") int categoryId,
+                                                  @RequestParam(value = "page", defaultValue = "1") int page,
+                                                  @RequestParam(value = "limit", defaultValue = "10") int size) {
 
-        return ResponseVO.ok(vo);
-    }
 
-    @GetMapping("/catalog/index")
-    public ResponseVO<CatalogVo> catalog() {
+        CategoryPageVo vo = goodsService.getGoodsAndBrotherCateById(categoryId, page, size);
+        log.debug("通过分类浏览商品 : 商品={}", vo.getGoodsList());
 
-        CatalogVo vo = catalogService.getCatalogIndex();
-        log.info("浏览分类页 : 主分类 = {}, 展示子分类 = {}", vo.getCategoryList(), vo.getCurrentCategory());
+        return ResponseVO.ok(vo);
+    }
 
+    @GetMapping("/goods/list/{categoryId}")
+    public ResponseVO<CategoryVo> getGoodsByCategory(@PathVariable("categoryId") int categoryId,
+                                                     @RequestParam(value = "page", defaultValue = "1") int page,
+                                                     @RequestParam(value = "limit", defaultValue = "10") int size) {
+        CategoryPageVo vo = goodsService.getGoodsByCateId(categoryId, page, size);
+        log.debug("通过分类浏览商品 : 商品={}", vo.getGoodsList());
         return ResponseVO.ok(vo);
+
     }
 
-    @GetMapping("/catalog/{id}")
-    public ResponseVO<CatalogVo> subCatalog(@PathVariable("id") int id) {
+    @GetMapping("/goods/detail/{goodsId}")
+    public ResponseVO<GoodsDetailPageVo> getGoodsDetail(@PathVariable("goodsId") int goodsId) {
+        GoodsDetailVo goodsDetail = goodsService.getGoodsDetail(goodsId);
+        List<GalleryVo> goodsGallery = goodsService.getGoodsGallery(goodsId);
+        //TODO comment
 
-        CatalogVo vo = catalogService.getCatalogById(id);
-        log.debug("筛选分类 : 获取子分类 = {}", vo.getCurrentCategory());
+        GoodsDetailPageVo vo = new GoodsDetailPageVo(goodsDetail, goodsGallery);
+        log.debug("浏览商品详情 : {}", vo);
 
         return ResponseVO.ok(vo);
     }
 
 
-
 }

+ 51 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/controller/IndexController.java

@@ -0,0 +1,51 @@
+package io.github.nnkwrik.goodsservice.controller;
+
+import io.github.nnkwrik.goodsservice.model.vo.CatalogVo;
+import io.github.nnkwrik.goodsservice.model.vo.IndexVO;
+import io.github.nnkwrik.goodsservice.model.vo.ResponseVO;
+import io.github.nnkwrik.goodsservice.service.IndexService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 19:49
+ */
+@Slf4j
+@RestController
+public class IndexController {
+
+    @Autowired
+    private IndexService indexService;
+
+    @GetMapping("/index/index")
+    public ResponseVO<IndexVO> index() {
+
+        IndexVO vo = indexService.getIndex();
+        log.debug("浏览首页 : 广告 = {},分类 = {}, 商品 = {}", vo.getBanner(), vo.getChannel(), vo.getIndexGoodsList());
+
+        return ResponseVO.ok(vo);
+    }
+
+    @GetMapping("/catalog/index")
+    public ResponseVO<CatalogVo> catalog() {
+
+        CatalogVo vo = indexService.getCatalogIndex();
+        log.debug("浏览分类页 : 主分类 = {}, 展示子分类 = {}", vo.getCategoryList(), vo.getCurrentCategory());
+
+        return ResponseVO.ok(vo);
+    }
+
+    @GetMapping("/catalog/{id}")
+    public ResponseVO<CatalogVo> subCatalog(@PathVariable("id") int id) {
+
+        CatalogVo vo = indexService.getCatalogById(id);
+        log.debug("筛选分类 : 获取子分类 = {}", vo.getCurrentCategory());
+
+        return ResponseVO.ok(vo);
+    }
+
+}

+ 6 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/dao/CategoryMapper.java

@@ -23,4 +23,10 @@ public interface CategoryMapper {
     @Select("select id,name from category where id = #{id}")
     Category findCategoryById(@Param("id") int id);
 
+    @Select("select id, name\n" +
+            "from category\n" +
+            "where parent_id = (select parent_id from category where id = #{id})\n" +
+            "order by sort_order asc;")
+    List<Category> findBrotherCategry(@Param("id") int id);
+
 }

+ 30 - 2
goods-service/src/main/java/io/github/nnkwrik/goodsservice/dao/GoodsMapper.java

@@ -1,8 +1,11 @@
 package io.github.nnkwrik.goodsservice.dao;
 
 import io.github.nnkwrik.goodsservice.model.po.Goods;
+import io.github.nnkwrik.goodsservice.model.po.GoodsGallery;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Service;
 
 import java.util.List;
 
@@ -15,9 +18,34 @@ public interface GoodsMapper {
 
     @Select("select id, `name`, primary_pic_url, price\n" +
             "from goods\n" +
-            "order by browse_count desc, last_edit desc\n" +
-            "limit 10;")
+            "where is_on_sale = 1 and is_delete = 0\n" +
+            "order by browse_count desc, last_edit desc")
     List<Goods> findSimpleGoods();
 
+    @Select("select id, `name`, primary_pic_url, price\n" +
+            "from goods\n" +
+            "where category_id = #{cateId}\n" +
+            "and is_on_sale = 1 and is_delete = 0\n" +
+            "order by browse_count desc, last_edit desc")
+    List<Goods> findSimpleGoodsByCateId(@Param("cateId") int cateId);
+
+    @Select("select id,\n" +
+            "       seller_id,\n" +
+            "       `name`,\n" +
+            "       price,\n" +
+            "       market_price,\n" +
+            "       primary_pic_url,\n" +
+            "       `desc`,\n" +
+            "       want_count,\n" +
+            "       browse_count,\n" +
+            "       last_edit\n" +
+            "from goods\n" +
+            "where id = #{goodsId}")
+    Goods findDetailGoodsByGoodsId(@Param("goodsId") int goodId);
+
+    @Select("select id, img_url\n" +
+            "from goods_gallery\n" +
+            "where goods_id = #{goodsId}")
+    List<GoodsGallery> findGalleryByGoodsId(@Param("goodsId") int goodId);
 
 }

+ 14 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/model/po/GoodsGallery.java

@@ -0,0 +1,14 @@
+package io.github.nnkwrik.goodsservice.model.po;
+
+import lombok.Data;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 21:52
+ */
+@Data
+public class GoodsGallery {
+    private Integer id;
+    private Integer goodsId;
+    private String imgUrl;
+}

+ 23 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/model/vo/CategoryPageVo.java

@@ -0,0 +1,23 @@
+package io.github.nnkwrik.goodsservice.model.vo;
+
+import io.github.nnkwrik.goodsservice.model.vo.inner.CategoryVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsSimpleVo;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 20:07
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CategoryPageVo {
+    private List<CategoryVo> brotherCategory; //同一个父分类下的兄弟分类
+    private List<GoodsSimpleVo> goodsList;    //当前分类的商品列表
+}
+
+

+ 23 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/model/vo/GoodsDetailPageVo.java

@@ -0,0 +1,23 @@
+package io.github.nnkwrik.goodsservice.model.vo;
+
+import io.github.nnkwrik.goodsservice.model.vo.inner.GalleryVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsDetailVo;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 21:43
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class GoodsDetailPageVo {
+    private GoodsDetailVo info;
+    private List<GalleryVo> gallery;
+    //TODO comment
+
+}

+ 13 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/model/vo/inner/GalleryVo.java

@@ -0,0 +1,13 @@
+package io.github.nnkwrik.goodsservice.model.vo.inner;
+
+import lombok.Data;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 21:53
+ */
+@Data
+public class GalleryVo {
+    private Integer id;
+    private String img_url;
+}

+ 18 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/model/vo/inner/GoodsDetailVo.java

@@ -0,0 +1,18 @@
+package io.github.nnkwrik.goodsservice.model.vo.inner;
+
+import lombok.Data;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 21:45
+ */
+@Data
+public class GoodsDetailVo extends GoodsSimpleVo {
+
+    private String goods_brief;
+    private Double market_price;
+    private Integer want_count;
+    private Integer browse_count;
+    private String last_edit;
+    //TODO seller
+}

+ 22 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/service/GoodsService.java

@@ -0,0 +1,22 @@
+package io.github.nnkwrik.goodsservice.service;
+
+import io.github.nnkwrik.goodsservice.model.vo.CategoryPageVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GalleryVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsDetailVo;
+
+import java.util.List;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 21:14
+ */
+public interface GoodsService {
+
+    CategoryPageVo getGoodsAndBrotherCateById(int id, int page, int size);
+
+    CategoryPageVo getGoodsByCateId(int id, int page, int size);
+
+    GoodsDetailVo getGoodsDetail(int id);
+
+    List<GalleryVo> getGoodsGallery(int goodsId);
+}

+ 1 - 1
goods-service/src/main/java/io/github/nnkwrik/goodsservice/service/CatalogService.java → goods-service/src/main/java/io/github/nnkwrik/goodsservice/service/IndexService.java

@@ -7,7 +7,7 @@ import io.github.nnkwrik.goodsservice.model.vo.IndexVO;
  * @author nnkwrik
  * @date 18/11/16 15:22
  */
-public interface CatalogService {
+public interface IndexService {
 
     IndexVO getIndex();
 

+ 72 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/service/impl/GoodsServiceImpl.java

@@ -0,0 +1,72 @@
+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.GoodsMapper;
+import io.github.nnkwrik.goodsservice.model.po.Category;
+import io.github.nnkwrik.goodsservice.model.po.Goods;
+import io.github.nnkwrik.goodsservice.model.po.GoodsGallery;
+import io.github.nnkwrik.goodsservice.model.vo.CategoryPageVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.CategoryVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GalleryVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsDetailVo;
+import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsSimpleVo;
+import io.github.nnkwrik.goodsservice.service.GoodsService;
+import io.github.nnkwrik.goodsservice.util.PO2VO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/17 21:15
+ */
+@Service
+public class GoodsServiceImpl implements GoodsService {
+
+    @Autowired
+    private CategoryMapper categoryMapper;
+
+    @Autowired
+    private GoodsMapper goodsMapper;
+
+
+    @Override
+    public CategoryPageVo getGoodsAndBrotherCateById(int id, int page, int size) {
+
+        List<Category> brotherCategory = categoryMapper.findBrotherCategry(id);
+        List<CategoryVo> brotherCategoryVo = PO2VO.convertList(PO2VO.category, brotherCategory);
+        CategoryPageVo vo = getGoodsByCateId(id, page, size);
+        vo.setBrotherCategory(brotherCategoryVo);
+
+        return vo;
+    }
+
+    @Override
+    public CategoryPageVo getGoodsByCateId(int id, int page, int size) {
+        //紧跟在这个方法后的第一个MyBatis 查询方法会被进行分页
+        PageHelper.startPage(page, size);
+        List<Goods> simpleGoods = goodsMapper.findSimpleGoodsByCateId(id);
+        List<GoodsSimpleVo> goodsSimpleVo = PO2VO.convertList(PO2VO.goodsSimple, simpleGoods);
+
+        return new CategoryPageVo(null, goodsSimpleVo);
+    }
+
+    @Override
+    public GoodsDetailVo getGoodsDetail(int id) {
+        Goods detailGoods = goodsMapper.findDetailGoodsByGoodsId(id);
+        GoodsDetailVo goodsDetailVo = PO2VO.convert(PO2VO.goodsDetail, detailGoods);
+        return goodsDetailVo;
+    }
+
+    @Override
+    public List<GalleryVo> getGoodsGallery(int goodsId) {
+        List<GoodsGallery> gallery = goodsMapper.findGalleryByGoodsId(goodsId);
+        List<GalleryVo> galleryVo = PO2VO.convertList(PO2VO.gallery, gallery);
+
+        return galleryVo;
+    }
+
+
+}

+ 11 - 9
goods-service/src/main/java/io/github/nnkwrik/goodsservice/service/impl/CatalogServiceImpl.java → goods-service/src/main/java/io/github/nnkwrik/goodsservice/service/impl/IndexServiceImpl.java

@@ -1,5 +1,6 @@
 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.GoodsMapper;
 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.ChannelVo;
 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 org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -25,7 +26,7 @@ import java.util.List;
  * @date 18/11/16 15:23
  */
 @Service
-public class CatalogServiceImpl implements CatalogService {
+public class IndexServiceImpl implements IndexService {
     @Autowired
     private CategoryMapper categoryMapper;
     @Autowired
@@ -37,15 +38,16 @@ public class CatalogServiceImpl implements CatalogService {
     public IndexVO getIndex() {
         //广告
         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<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<GoodsSimpleVo> goodsSimpleVOList = PO2VO.convertList(PO2VO.GoodsSimple, goodsList);
+        List<GoodsSimpleVo> goodsSimpleVOList = PO2VO.convertList(PO2VO.goodsSimple, goodsList);
 
         return new IndexVO(goodsSimpleVOList, bannerVoList, channelVoList);
     }
@@ -57,8 +59,8 @@ public class CatalogServiceImpl implements CatalogService {
         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 =
                 new CategoryVo(currentCate.getId(), currentCate.getName(), currentCate.getIconUrl(), subCategoryVo);
 
@@ -68,9 +70,9 @@ public class CatalogServiceImpl implements CatalogService {
     @Override
     public CatalogVo getCatalogById(int 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);
-        CategoryVo currentCategoryVo = PO2VO.convert(PO2VO.Category, currentCategory);
+        CategoryVo currentCategoryVo = PO2VO.convert(PO2VO.category, currentCategory);
         currentCategoryVo.setSubCategoryList(subCategoryVo);
 
         return new CatalogVo(null, currentCategoryVo);

+ 32 - 14
goods-service/src/main/java/io/github/nnkwrik/goodsservice/util/PO2VO.java

@@ -1,15 +1,10 @@
 package io.github.nnkwrik.goodsservice.util;
 
-import io.github.nnkwrik.goodsservice.model.po.Ad;
-import io.github.nnkwrik.goodsservice.model.po.Category;
-import io.github.nnkwrik.goodsservice.model.po.Channel;
-import io.github.nnkwrik.goodsservice.model.po.Goods;
-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.ChannelVo;
-import io.github.nnkwrik.goodsservice.model.vo.inner.GoodsSimpleVo;
+import io.github.nnkwrik.goodsservice.model.po.*;
+import io.github.nnkwrik.goodsservice.model.vo.inner.*;
 import org.springframework.beans.BeanUtils;
 
+import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -20,7 +15,7 @@ import java.util.stream.Collectors;
  */
 public class PO2VO {
 
-    public static Function<Category, CategoryVo> Category =
+    public static Function<Category, CategoryVo> category =
             po -> {
                 CategoryVo vo = new CategoryVo();
                 BeanUtils.copyProperties(po, vo);
@@ -29,7 +24,7 @@ public class PO2VO {
                 return vo;
             };
 
-    public static Function<Channel, ChannelVo> Channel =
+    public static Function<Channel, ChannelVo> channel =
             po -> {
                 ChannelVo vo = new ChannelVo();
                 BeanUtils.copyProperties(po, vo);
@@ -37,7 +32,15 @@ public class PO2VO {
                 return vo;
             };
 
-    public static Function<Goods, GoodsSimpleVo> GoodsSimple =
+    public static Function<Ad, BannerVo> banner =
+            po -> {
+                BannerVo vo = new BannerVo();
+                BeanUtils.copyProperties(po, vo);
+                vo.setImage_url(po.getImageUrl());
+                return vo;
+            };
+
+    public static Function<Goods, GoodsSimpleVo> goodsSimple =
             po -> {
                 GoodsSimpleVo vo = new GoodsSimpleVo();
                 BeanUtils.copyProperties(po, vo);
@@ -45,11 +48,26 @@ public class PO2VO {
                 return vo;
             };
 
-    public static Function<Ad, BannerVo> Banner =
+    public static Function<Goods, GoodsDetailVo> goodsDetail =
             po -> {
-                BannerVo vo = new BannerVo();
+                GoodsSimpleVo simpleVo = convert(goodsSimple, po);
+                GoodsDetailVo vo = new GoodsDetailVo();
+                BeanUtils.copyProperties(simpleVo, vo);
+                vo.setGoods_brief(po.getDesc());
+                vo.setMarket_price(po.getMarketPrice());
+                vo.setWant_count(po.getWantCount());
+                vo.setBrowse_count(po.getBrowseCount());
+                //Date转String
+                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+                vo.setLast_edit(formatter.format(po.getLastEdit()));
+                return vo;
+            };
+
+    public static Function<GoodsGallery,GalleryVo > gallery =
+            po -> {
+                GalleryVo vo = new GalleryVo();
                 BeanUtils.copyProperties(po, vo);
-                vo.setImage_url(po.getImageUrl());
+                vo.setImg_url(po.getImgUrl());
                 return vo;
             };