Browse Source

:disappointed_relieved: 商品分类

nnkwrik 6 năm trước cách đây
mục cha
commit
cdf675b35e

+ 103 - 0
goods-service/pom.xml

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>io.github.nnkwrik</groupId>
+    <artifactId>goods-service</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>jar</packaging>
+
+    <name>goods-service</name>
+    <description>Demo project for Spring Boot</description>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.1.0.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+        <spring-cloud.version>Greenwich.M1</spring-cloud.version>
+    </properties>
+
+    <dependencies>
+        <!--<dependency>-->
+            <!--<groupId>org.springframework.cloud</groupId>-->
+            <!--<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>-->
+        <!--</dependency>-->
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>1.3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.github.nnkwrik</groupId>
+            <artifactId>common</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+
+    </dependencies>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>${spring-cloud.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>spring-milestones</id>
+            <name>Spring Milestones</name>
+            <url>https://repo.spring.io/milestone</url>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
+
+
+</project>

+ 13 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/GoodsServiceApplication.java

@@ -0,0 +1,13 @@
+package io.github.nnkwrik.goodsservice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+
+public class GoodsServiceApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(GoodsServiceApplication.class, args);
+    }
+}

+ 207 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/controller/GoodsController.java

@@ -0,0 +1,207 @@
+package io.github.nnkwrik.goodsservice.controller;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.github.nnkwrik.goodsservice.dao.GoodsMapper;
+import io.github.nnkwrik.goodsservice.model.po.Category;
+import io.github.nnkwrik.goodsservice.model.po.Channel;
+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 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;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/14 18:42
+ */
+@RestController
+public class GoodsController {
+
+    @Autowired
+    private GoodsMapper goodsMapper;
+
+    //    @GetMapping("/index/index")
+    public String test() throws JsonProcessingException {
+
+//          newGoods: res.data.newGoodsList,
+//          hotGoods: res.data.hotGoodsList,
+//          topics: res.data.topicList,
+//          brand: res.data.brandList,
+//          floorGoods: res.data.categoryList,
+//          banner: res.data.banner,
+//          channel: res.data.channel
+
+        Map<String, Object> json = new HashMap<>();
+
+        Map<String, Object> data = new HashMap<>();
+
+        String img = "https://nnkwrik.github.io/2018/11/12/20181112/1541980429999.png";
+
+        List<Map> newGoodsList = new ArrayList<>();
+        Map<String, Object> newGoodsListIn = new HashMap<>();
+        newGoodsList.add(newGoodsListIn);
+
+        newGoodsListIn.put("id", 1);
+        newGoodsListIn.put("list_pic_url", img);
+        newGoodsListIn.put("name", "newGoods");
+        newGoodsListIn.put("retail_price", 100);
+
+
+        Map<String, Object> hotGoodsList = new HashMap<>();
+        hotGoodsList.put("id", 1);
+        hotGoodsList.put("list_pic_url", img);
+        hotGoodsList.put("name", "hotGoodsList");
+        hotGoodsList.put("retail_price", 100);
+        hotGoodsList.put("goods_brief", "热门铲平");
+
+        Map<String, Object> categoryList = new HashMap<>();
+        Map<String, Object> categoryListIn = new HashMap<>();
+        categoryList.put("categoryList", categoryListIn);
+
+        categoryListIn.put("id", 1);
+        categoryListIn.put("list_pic_url", img);
+        categoryListIn.put("name", "categoryListIn");
+        categoryListIn.put("retail_price", 100);
+
+        data.put("newGoodsList", newGoodsList);
+        data.put("hotGoodsList", hotGoodsList);
+        data.put("categoryList", categoryList);
+
+        json.put("data", data);
+        String res = new ObjectMapper().writeValueAsString(json);
+//        System.out.println(res);
+
+//        "{\"errno\":0," +
+//                "\"errmsg\":\"\"," +
+//                "\"data\":{" +
+//                "\"banner\":[{\"id\":1,\"ad_position_id\":1,\"media_type\":1,\"name\":\"合作 谁是你的菜\",\"link\":\"\",\"image_url\":\"http://yanxuan.nosdn.127.net/65091eebc48899298171c2eb6696fe27.jpg\",\"content\":\"合作 谁是你的菜\",\"end_time\":0,\"enabled\":1}," +
+//                "{\"id\":2,\"ad_position_id\":1,\"media_type\":1,\"name\":\"活动 美食节\",\"link\":\"\",\"image_url\":\"http://yanxuan.nosdn.127.net/bff2e49136fcef1fd829f5036e07f116.jpg\",\"content\":\"活动 美食节\",\"end_time\":0,\"enabled\":1}," +
+//                "{\"id\":3,\"ad_position_id\":1,\"media_type\":1,\"name\":\"活动 母亲节\",\"link\":\"\",\"image_url\":\"http://yanxuan.nosdn.127.net/8e50c65fda145e6dd1bf4fb7ee0fcecc.jpg\",\"content\":\"活动 母亲节\",\"end_time\":0,\"enabled\":1}]," +
+//                "\"channel\":[{\"id\":1,\"name\":\"居家\",\"url\":\"/pages/category/category?id=1005000\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/c031ea3cf575f885cd1c.png\",\"sort_order\":1}," +
+//                "{\"id\":2,\"name\":\"餐厨\",\"url\":\"/pages/category/category?id=1005001\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/4fbe8913819b017ebe1b.png\",\"sort_order\":2}," +
+//                "{\"id\":3,\"name\":\"配件\",\"url\":\"/pages/category/category?id=1008000\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/e8070853e6c6f5627713.png\",\"sort_order\":3}," +
+//                "{\"id\":4,\"name\":\"服装\",\"url\":\"/pages/category/category?id=1005002\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/4fa3c0c72964901c5a45.png\",\"sort_order\":4}," +
+//                "{\"id\":5,\"name\":\"志趣\",\"url\":\"/pages/category/category?id=1019000\",\"icon_url\":\"http://ac-"
+
+        String a = "{\"errno\":0," +
+                "\"errmsg\":\"\"," +
+                "\"data\":{" +
+                "\"newGoodsList\":[{\"id\":1,\"name\":\"居家\",\"list_pic_url\":\"" + img + "\",\"retail_price\":100}," +
+                "{\"id\":1,\"name\":\"居家\",\"list_pic_url\":\"" + img + "\",\"retail_price\":100}]," +
+                "\"hotGoodsList\":[{\"id\":1,\"name\":\"居家\",\"list_pic_url\":\"" + img + "\",\"retail_price\":100,\"goods_brief\":\"热门铲平\"}," +
+                "{\"id\":1,\"name\":\"居家\",\"list_pic_url\":\"" + img + "\",\"retail_price\":100,\"goods_brief\":\"热门铲平\"}]," +
+                "\"categoryList\":[{\"id\":1,\"name\":\"居家\",\"list_pic_url\":\"" + img + "\",\"retail_price\":100}," +
+                "{\"id\":2,\"name\":\"居家\",\"list_pic_url\":\"" + img + "\",\"retail_price\":100}]," +
+                "\"topicList\":[{\"id\":1,\"title\":\"居家\",\"scene_pic_url\":\"" + img + "\",\"price_info\":100,\"subtitle\":\"热门铲平\"}," +
+                "{\"id\":1,\"title\":\"居家\",\"scene_pic_url\":\"" + img + "\",\"price_info\":100,\"subtitle\":\"热门铲平\"}]," +
+                "\"brandList\":[{\"id\":1,\"name\":\"居家\",\"new_pic_url\":\"" + img + "\",\"floor_price\":100}," +
+                "{\"id\":1,\"name\":\"居家\",\"new_pic_url\":\"" + img + "\",\"floor_price\":100}]," +
+                "\"channel\":[{\"id\":1,\"name\":\"居家\",\"url\":\"/pages/category/category?id=1005000\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/c031ea3cf575f885cd1c.png\",\"sort_order\":1}," +
+                "{\"id\":2,\"name\":\"餐厨\",\"url\":\"/pages/category/category?id=1005001\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/4fbe8913819b017ebe1b.png\",\"sort_order\":2}," +
+                "{\"id\":3,\"name\":\"配件\",\"url\":\"/pages/category/category?id=1008000\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/e8070853e6c6f5627713.png\",\"sort_order\":3}," +
+                "{\"id\":2,\"name\":\"餐厨\",\"url\":\"/pages/category/category?id=1005001\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/4fbe8913819b017ebe1b.png\",\"sort_order\":2}," +
+                "{\"id\":3,\"name\":\"配件\",\"url\":\"/pages/category/category?id=1008000\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/e8070853e6c6f5627713.png\",\"sort_order\":3}," +
+                "{\"id\":2,\"name\":\"餐厨\",\"url\":\"/pages/category/category?id=1005001\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/4fbe8913819b017ebe1b.png\",\"sort_order\":2}," +
+                "{\"id\":3,\"name\":\"配件\",\"url\":\"/pages/category/category?id=1008000\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/e8070853e6c6f5627713.png\",\"sort_order\":3}," +
+                "{\"id\":4,\"name\":\"服装\",\"url\":\"/pages/category/category?id=1005002\",\"icon_url\":\"http://ac-3yr0g9cz.clouddn.com/4fa3c0c72964901c5a45.png\",\"sort_order\":4}]," +
+                "\"banner\":[{\"id\":1,\"ad_position_id\":1,\"media_type\":1,\"name\":\"合作 谁是你的菜\",\"link\":\"\",\"image_url\":\"" + img + "\",\"content\":\"合作 谁是你的菜\",\"end_time\":0,\"enabled\":1}," +
+                "{\"id\":1,\"ad_position_id\":1,\"media_type\":1,\"name\":\"合作 谁是你的菜\",\"link\":\"\",\"image_url\":\"" + img + "\",\"content\":\"合作 谁是你的菜\",\"end_time\":0,\"enabled\":1}]" +
+                "}}";
+
+
+        return a;
+
+//        Map<String,Object>  channel = new HashMap<>();
+//
+//
+//
+//        Map<String,Object>  topicList = new HashMap<>();
+//        Map<String,Object>  brandList = new HashMap<>();
+//        Map<String,Object>  banner = new HashMap<>();
+
+    }
+
+    @GetMapping("/index/index")
+    public ResponseVO<IndexVO> index() {
+
+        List<Channel> channelList = goodsMapper.findChannel();
+        IndexVO indexVO = IndexVO.createFromPo(channelList);
+//        indexVO.setChannel(channelList);
+
+        System.out.println(indexVO);
+
+        return ResponseVO.ok(indexVO);
+    }
+
+    @GetMapping("/catalog/index")
+    public ResponseVO<CatalogVo> catalog() {
+
+//        navList: [], res.data.categoryList, List[id,name]
+//        categoryList: [],
+//        currentCategory: {}, wap_banner_url,front_name,name,subCategoryList[id,name,wap_banner_url,cat_id]
+//
+//        navList:
+//                currentCategory:
+//goodsList id list_pic_url name retail_price
+
+        List<Category> mainCategory = goodsMapper.findMainCategory();
+        List<Category> subCategory = goodsMapper.findSubCategory(mainCategory.get(0).getId());
+
+        CatalogVo vo = CatalogVo.createFromPo(mainCategory,subCategory);
+
+
+//        Category currentCategory = new Category();
+//        currentCategory.setId(mainCategory.get(0).getId());
+//        currentCategory.setName(mainCategory.get(0).getName());
+//
+//
+//        List<CategoryVo> categoryList = po2voList(mainCategory);
+//        List<CategoryVo> subCategoryVo = po2voList(subCategory);
+//
+//        CategoryVo currentCategory = new CategoryVo();
+//        currentCategory.setId(categoryList.get(0).getId());
+//        currentCategory.setName(categoryList.get(0).getName());
+//        currentCategory.setSubCategoryList(subCategory);
+//
+//        CatalogVo vo = new CatalogVo();
+//        vo.setCategoryList(categoryList);
+//        vo.setCurrentCategory(currentCategory);
+
+
+        System.out.println(vo);
+
+        return ResponseVO.ok(vo);
+    }
+
+    @GetMapping("/catalog/{id}")
+    public ResponseVO<CatalogVo> subCatalog(@PathVariable("id") int id){
+        List<Category> subCategory = goodsMapper.findSubCategory(id);
+//        List<CategoryVo> subCategoryVo = po2voList(subCategory);
+//        Category currentCategory = goodsMapper.findCategoryById(id);
+//        CategoryVo currentCategoryVo = PO2VO.Category.apply(currentCategory);
+//
+//
+//        currentCategoryVo.setSubCategoryList(subCategoryVo);
+//        vo.setCurrentCategory(currentCategoryVo);
+        CatalogVo vo = CatalogVo.createFromPo(subCategory);
+
+        return ResponseVO.ok(vo);
+    }
+
+//    private List<CategoryVo> po2voList(List<Category> poList){
+//        return poList.stream()
+//                .map(PO2VO.Category).collect(Collectors.toList());
+//    }
+
+
+
+
+}

+ 29 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/dao/GoodsMapper.java

@@ -0,0 +1,29 @@
+package io.github.nnkwrik.goodsservice.dao;
+
+import io.github.nnkwrik.goodsservice.model.po.Category;
+import io.github.nnkwrik.goodsservice.model.po.Channel;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/14 22:19
+ */
+@Mapper
+public interface GoodsMapper {
+    @Select("select * from channel order by sort_order asc")
+    List<Channel> findChannel();
+
+    @Select("select * from category where parent_id = 0 order by sort_order asc")
+    List<Category> findMainCategory();
+
+    @Select("select * from category where parent_id = #{parentId} order by sort_order asc")
+    List<Category> findSubCategory(@Param("parentId") int parentId);
+
+    @Select("select * from category where id = #{id}")
+    Category findCategoryById(@Param("id") int id);
+
+}

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

@@ -0,0 +1,16 @@
+package io.github.nnkwrik.goodsservice.model.po;
+
+import lombok.Data;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/15 16:27
+ */
+@Data
+public class Category {
+    private Integer id;
+    private String name;
+    private Integer parentId;
+    private String iconUrl;
+    private Integer sortOrder;
+}

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

@@ -0,0 +1,16 @@
+package io.github.nnkwrik.goodsservice.model.po;
+
+import lombok.Data;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/14 22:20
+ */
+@Data
+public class Channel{
+    private Integer id;
+    private String name;
+    private String url;
+    private String iconUrl;
+    private Integer sortOrder;
+}

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

@@ -0,0 +1,65 @@
+package io.github.nnkwrik.goodsservice.model.vo;
+
+import io.github.nnkwrik.goodsservice.model.po.Category;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/15 16:18
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CatalogVo {
+    private List<CategoryVo> categoryList;   //所有主分类
+    private  CategoryVo currentCategory;    //当前主分类的名字和它的子分类
+
+
+
+
+    //todo
+    public static CatalogVo createFromPo(List<Category> subCategory){
+        return createFromPo(null,subCategory);
+    }
+
+    public static CatalogVo createFromPo(List<Category> mainCategory,List<Category> subCategory){
+        Function<Category, CategoryVo> po2vo =
+                cate -> {
+                    CategoryVo vo = new CategoryVo();
+                    vo.setId(cate.getId());
+                    vo.setName(cate.getName());
+                    vo.setWap_banner_url(cate.getIconUrl());
+                    return vo;
+                };
+        List<CategoryVo> categoryListVo = mainCategory.stream()
+                .map(po2vo).collect(Collectors.toList());
+
+        List<CategoryVo> subCategoryVo = subCategory.stream()
+                .map(po2vo).collect(Collectors.toList());
+
+        CategoryVo currentCategoryVo = new CategoryVo();
+        currentCategoryVo.setId(mainCategory.get(0).getId());
+        currentCategoryVo.setName(mainCategory.get(0).getName());
+        currentCategoryVo.setSubCategoryList(subCategoryVo);
+
+        return new CatalogVo(categoryListVo,currentCategoryVo);
+
+    }
+
+}
+
+@Data
+class CategoryVo {
+    private Integer id;
+    private String name;
+    private String wap_banner_url;
+    private List<CategoryVo> subCategoryList;
+}
+
+

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

@@ -0,0 +1,67 @@
+package io.github.nnkwrik.goodsservice.model.vo;
+
+import io.github.nnkwrik.goodsservice.model.po.Channel;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.beans.BeanUtils;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/14 20:57
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class IndexVO {
+    private List<GoodsSimpleVO> indexGoodsList;
+    private List<BannerVo> banner;
+    private List<ChannelVo> channel;
+
+
+    //todo
+    public static IndexVO createFromPo(List<Channel> channelPo) {
+        List<ChannelVo> channelVo = channelPo.stream()
+                .map(po -> {
+                    ChannelVo vo = new ChannelVo();
+                    BeanUtils.copyProperties(po, vo);
+                    vo.setIcon_url(po.getIconUrl());
+                    return vo;
+                }).collect(Collectors.toList());
+
+        return new IndexVO(null,null,channelVo);
+    }
+
+}
+
+@Data
+class GoodsSimpleVO {
+    private Integer id;
+    private String name;
+    private String list_pic_url;
+    private Double retail_price;
+}
+
+@Data
+class BannerVo {
+    private Integer id;
+    private String name;
+    private String image_url;
+    private Integer ad_position_id = 1;
+    private Integer media_type = 1;
+    private String link;
+    private String content;
+    private Integer end_time = 0;
+    private Integer enabled = 1;
+}
+
+@Data
+class ChannelVo {
+    private Integer id;
+    private String name;
+    private String url;
+    private String icon_url;
+}

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

@@ -0,0 +1,34 @@
+package io.github.nnkwrik.goodsservice.model.vo;
+
+import lombok.Data;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/14 21:07
+ */
+@Data
+public class ResponseVO<T> {
+    private int errno;
+    private String errmsg;
+    private T data;
+
+
+    public ResponseVO(T data) {
+        this.data = data;
+    }
+
+    public ResponseVO(int errno, String errmsg) {
+        this.errno = errno;
+        this.errmsg = errmsg;
+    }
+
+
+    public static <T> ResponseVO ok(T data) {
+        return new ResponseVO(data);
+    }
+
+    public static ResponseVO fail(int errno, String errmsg) {
+        return new ResponseVO(errno, errmsg);
+    }
+
+}

+ 18 - 0
goods-service/src/main/java/io/github/nnkwrik/goodsservice/util/PO2VO.java

@@ -0,0 +1,18 @@
+package io.github.nnkwrik.goodsservice.util;
+
+/**
+ * @author nnkwrik
+ * @date 18/11/15 18:00
+ */
+public class PO2VO {
+//
+//    public static Function<Category, CategoryVo> Category =
+//            cate -> {
+//                CategoryVo vo = new CategoryVo();
+//                vo.setId(cate.getId());
+//                vo.setName(cate.getName());
+//                vo.setWap_banner_url(cate.getIconUrl());
+//                return vo;
+//            };
+
+}

+ 14 - 0
goods-service/src/main/resources/application.yml

@@ -0,0 +1,14 @@
+spring:
+  application:
+    name: goods-service
+  datasource:
+    url: jdbc:mysql://localhost:3306/goods_service
+    username: root
+    password: 1234
+    driver-class-name: com.mysql.cj.jdbc.Driver
+server:
+  port: 8804
+
+mybatis:
+  configuration:
+    map-underscore-to-camel-case: true

+ 16 - 0
goods-service/src/test/java/io/github/nnkwrik/goodsservice/GoodsServiceApplicationTests.java

@@ -0,0 +1,16 @@
+package io.github.nnkwrik.goodsservice;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class GoodsServiceApplicationTests {
+
+    @Test
+    public void contextLoads() {
+    }
+
+}

+ 0 - 5
user-service/pom.xml

@@ -59,11 +59,6 @@
             <scope>provided</scope>
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-redis</artifactId>
-        </dependency>
-
         <dependency>
             <groupId>com.auth0</groupId>
             <artifactId>java-jwt</artifactId>

+ 0 - 12
user-service/src/main/java/io/github/nnkwrik/userservice/controller/UserController.java

@@ -59,18 +59,6 @@ public class UserController {
         return response;
     }
 
-//    //TODO 如果这个步骤比较频繁的话,需要另外做成一个服务
-//    @PostMapping("/checkSession")
-//    public Response checkSession(@RequestBody UserDTO userDTO) {
-//        UserDTO cache = redisClient.get(userDTO.getSessionKey());
-//        if (cache.equals(userDTO)) return Response.ok();
-//        return Response.fail("无效的Session");
-//    }
-//
-//    @PostMapping("/updateUserInfo") //UserInfo 发生变化时sessionKey肯定会变
-//    public Response updateUserInfo(@RequestBody User user) {
-//
-//    }
 
 
 }