commit 85846516f1986a3320d0909be4e392936b142aa3
Author: YunaiV <>
Date: Thu Feb 21 20:12:29 2019 +0800
初始化项目结构(未完成)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..08c97607f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,25 @@
+/target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+/build/
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 000000000..1caaaca08
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,21 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.3.RELEASE
+
+
+
+ cn.iocoder.mall
+ mall-parent
+ 1.0-SNAPSHOT
+
+ product
+
+ pom
+
+
\ No newline at end of file
diff --git a/product/pom.xml b/product/pom.xml
new file mode 100644
index 000000000..eb58b3c4c
--- /dev/null
+++ b/product/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ mall-parent
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ product
+ pom
+
+ product-application
+ product-service
+ product-service-api
+
+
+
+
\ No newline at end of file
diff --git a/product/product-application/pom.xml b/product/product-application/pom.xml
new file mode 100644
index 000000000..01a6224d5
--- /dev/null
+++ b/product/product-application/pom.xml
@@ -0,0 +1,52 @@
+
+
+
+ product
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ product-rest
+
+
+
+ cn.iocoder.mall
+ product-service-api
+ 1.0-SNAPSHOT
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ com.alibaba
+ dubbo
+ 2.6.5
+
+
+
+ com.alibaba.boot
+ dubbo-spring-boot-starter
+ 0.2.1.RELEASE
+
+
+
+ org.apache.curator
+ curator-framework
+ 2.12.0
+
+
+
+
+
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/ProductRestApplication.java b/product/product-application/src/main/java/cn/iocoder/mall/product/ProductRestApplication.java
new file mode 100644
index 000000000..0af823ca0
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/ProductRestApplication.java
@@ -0,0 +1,13 @@
+package cn.iocoder.mall.product;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ProductRestApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ProductRestApplication.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/bo/ProductSkuBO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/bo/ProductSkuBO.java
new file mode 100644
index 000000000..858ab2272
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/bo/ProductSkuBO.java
@@ -0,0 +1,15 @@
+package cn.iocoder.mall.product.bo;
+
+public class ProductSkuBO {
+
+ private Integer id;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/bo/ProductSpuBO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/bo/ProductSpuBO.java
new file mode 100644
index 000000000..06b881899
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/bo/ProductSpuBO.java
@@ -0,0 +1,15 @@
+package cn.iocoder.mall.product.bo;
+
+public class ProductSpuBO {
+
+ private Integer id;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductCategoryController.java b/product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductCategoryController.java
new file mode 100644
index 000000000..fbe5d1b62
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductCategoryController.java
@@ -0,0 +1,22 @@
+package cn.iocoder.mall.product.controller;
+
+import cn.iocoder.mall.product.vo.ProductCategoryVO;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@RequestMapping("/product/category")
+public class ProductCategoryController {
+
+ // TODO 获得父编号为 id 的分类们 后面,使用 swagger 注释
+ @GetMapping
+ public List list(@RequestParam("id") Integer id) {
+ return new ArrayList<>();
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductSpuController.java b/product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductSpuController.java
new file mode 100644
index 000000000..a11b616b3
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductSpuController.java
@@ -0,0 +1,31 @@
+package cn.iocoder.mall.product.controller;
+
+import cn.iocoder.mall.product.bo.ProductSpuBO;
+import cn.iocoder.mall.product.service.ProductSpuService;
+import cn.iocoder.mall.product.vo.ProductSpuListVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/product/spu")
+public class ProductSpuController {
+
+ @Autowired
+ private ProductSpuService productSpuService;
+
+ // TODO 详情
+ @GetMapping("/info")
+ public ProductSpuBO info(@RequestParam("id") Integer id) {
+ return productSpuService.getProductSpu(id);
+ }
+
+ // TODO 分页
+ @GetMapping("/list")
+ public ProductSpuListVO list() {
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/dao/ProductSpuDAO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/dao/ProductSpuDAO.java
new file mode 100644
index 000000000..84ff091ae
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/dao/ProductSpuDAO.java
@@ -0,0 +1,15 @@
+package cn.iocoder.mall.product.dao;
+
+import cn.iocoder.mall.product.dataobject.ProductSpuDO;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class ProductSpuDAO {
+
+ public ProductSpuDO selectById(Integer id) {
+ ProductSpuDO spu = new ProductSpuDO();
+ spu.setId(id);
+ return spu;
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java
new file mode 100644
index 000000000..450e8e075
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrDO.java
@@ -0,0 +1,34 @@
+package cn.iocoder.mall.product.dataobject;
+
+import java.util.Date;
+
+/**
+ * Product 规格
+ */
+public class ProductAttrDO {
+
+ /**
+ * 规格编号
+ */
+ private Integer id;
+ /**
+ * 名称
+ */
+ private String name;
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+ /**
+ * 最后更新时间
+ */
+ private Date updateTime;
+ /**
+ * 状态
+ *
+ * 1-正常
+ * 2-删除
+ */
+ private Integer status;
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java
new file mode 100644
index 000000000..9ebdb6672
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductAttrValueDO.java
@@ -0,0 +1,38 @@
+package cn.iocoder.mall.product.dataobject;
+
+import java.util.Date;
+
+/**
+ * Product 规格值
+ */
+public class ProductAttrValueDO {
+
+ /**
+ * 规格值编号
+ */
+ private Integer id;
+ /**
+ * 规格编号
+ */
+ private Integer attrId;
+ /**
+ * 规格值
+ */
+ private String name;
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+ /**
+ * 最后更新时间
+ */
+ private Date updateTime;
+ /**
+ * 状态
+ *
+ * 1-正常
+ * 2-删除
+ */
+ private Integer status;
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java
new file mode 100644
index 000000000..4b944551c
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java
@@ -0,0 +1,52 @@
+package cn.iocoder.mall.product.dataobject;
+
+import java.util.Date;
+
+/**
+ * 商品分类
+ */
+public class ProductCategoryDO {
+
+ /**
+ * 分类编号
+ */
+ private Integer id;
+ /**
+ * 父分类编号
+ *
+ * 如果不存在父级,则 pid = 0 。
+ */
+ private Integer pid;
+ /**
+ * 名称
+ */
+ private String name;
+ /**
+ * 描述
+ */
+ private String description;
+ /**
+ * 分类图片
+ */
+ private String picURL;
+ /**
+ * 排序值
+ */
+ private Integer sort;
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+ /**
+ * 最后更新时间
+ */
+ private Date updateTime;
+ /**
+ * 状态
+ *
+ * 1-正常
+ * 2-删除
+ */
+ private Integer status;
+
+}
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java
new file mode 100644
index 000000000..737c0eaf6
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java
@@ -0,0 +1,59 @@
+package cn.iocoder.mall.product.dataobject;
+
+import java.util.Date;
+
+/**
+ * 商品 SKU
+ */
+public class ProductSkuDO {
+
+ /**
+ * sku 编号
+ */
+ private Integer id;
+ /**
+ * 商品编号
+ */
+ private Integer itemId;
+
+ // TODO 店铺编号
+
+ /**
+ * 状态
+ *
+ * 1-正常
+ * 2-删除
+ */
+ private Integer status;
+ /**
+ * 图片地址
+ */
+ private String picURL;
+ /**
+ * 规格值({@link ProductAttrDO})数组
+ *
+ * 数组,以逗号分隔
+ */
+ private String attrs;
+ /**
+ * 价格,单位分
+ */
+ private Integer price;
+ /**
+ * 商品在付款减库存的状态下,该Sku上未付款的订单数量
+ */
+ private Integer withHoldQuantity;
+ /**
+ * 销量
+ */
+ private Integer soldNum;
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+ /**
+ * 更新时间
+ */
+ private Date updateTime;
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java
new file mode 100644
index 000000000..f406b7f8b
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java
@@ -0,0 +1,82 @@
+package cn.iocoder.mall.product.dataobject;
+
+import java.util.Date;
+
+/**
+ * 商品 SPU
+ */
+public class ProductSpuDO {
+
+ // ========== 基础字段 =========
+
+ /**
+ * SPU 编号
+ */
+ private Integer id;
+
+ // TODO 店铺编号
+
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+ /**
+ * 最后更新时间
+ */
+ private Date updateTime;
+ /**
+ * 状态
+ *
+ * 1-正常
+ * 2-删除
+ */
+ private Integer status;
+
+ // ========== 基本信息 =========
+ /**
+ * SPU 名字
+ */
+ private String name;
+ /**
+ * SPU 描述
+ */
+ private String descrption;
+ /**
+ * 分类编号
+ */
+ private Integer cid;
+ /**
+ * 商品主图地址
+ *
+ * 数组,以逗号分隔
+ *
+ * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
+ */
+ private String picURLs;
+
+ // TODO 价格库存
+
+ // TODO 运费信息
+
+ // ========== 其他信息 =========
+ /**
+ * 是否上架商品(是否可见)。
+ *
+ * true 为已上架
+ * false 为已下架
+ */
+ private Boolean visible;
+ /**
+ * 排序字段
+ */
+ private Integer order;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java
new file mode 100644
index 000000000..ff1e814ae
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java
@@ -0,0 +1,38 @@
+package cn.iocoder.mall.product.dataobject;
+
+import java.util.Date;
+
+/**
+ * Product 库存
+ */
+public class ProductStockDO {
+
+ /**
+ * 编号,自增
+ */
+ private Integer id;
+ /**
+ * SKU 编号
+ */
+ private Integer skuId;
+ /**
+ * 库存数
+ */
+ private Integer quantity;
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+ /**
+ * 最后更新时间
+ */
+ private Date updateTime;
+ /**
+ * 状态
+ *
+ * 1-正常
+ * 2-删除
+ */
+ private Integer status;
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/service/ProductSpuService.java b/product/product-application/src/main/java/cn/iocoder/mall/product/service/ProductSpuService.java
new file mode 100644
index 000000000..b74d83122
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/service/ProductSpuService.java
@@ -0,0 +1,23 @@
+package cn.iocoder.mall.product.service;
+
+import cn.iocoder.mall.product.bo.ProductSpuBO;
+import cn.iocoder.mall.product.dao.ProductSpuDAO;
+import cn.iocoder.mall.product.dataobject.ProductSpuDO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
+@com.alibaba.dubbo.config.annotation.Service
+public class ProductSpuService implements cn.iocoder.mall.product.service.api.ProductSpuService {
+
+ @Autowired
+ private ProductSpuDAO productSpuDAO;
+
+ public ProductSpuBO getProductSpu(Integer id) {
+ ProductSpuDO productSpuDO = productSpuDAO.selectById(id);
+ ProductSpuBO productSpuBO = new ProductSpuBO(); // TODO 芋艿,后面改下
+ productSpuBO.setId(productSpuDO.getId());
+ return productSpuBO;
+ }
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductCategoryVO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductCategoryVO.java
new file mode 100644
index 000000000..d6e1fbf0c
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductCategoryVO.java
@@ -0,0 +1,4 @@
+package cn.iocoder.mall.product.vo;
+
+public class ProductCategoryVO {
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductSpuListVO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductSpuListVO.java
new file mode 100644
index 000000000..3b70bbf35
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductSpuListVO.java
@@ -0,0 +1,16 @@
+package cn.iocoder.mall.product.vo;
+
+import java.util.List;
+
+public class ProductSpuListVO {
+
+ /**
+ * SPU 数组
+ */
+ private List list;
+ /**
+ * 是否还有下一页
+ */
+ private Boolean hasNext;
+
+}
\ No newline at end of file
diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductSpuVO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductSpuVO.java
new file mode 100644
index 000000000..8e2e1b892
--- /dev/null
+++ b/product/product-application/src/main/java/cn/iocoder/mall/product/vo/ProductSpuVO.java
@@ -0,0 +1,4 @@
+package cn.iocoder.mall.product.vo;
+
+public class ProductSpuVO {
+}
diff --git a/product/product-application/src/main/resources/application.properties b/product/product-application/src/main/resources/application.properties
new file mode 100644
index 000000000..3bb6630a7
--- /dev/null
+++ b/product/product-application/src/main/resources/application.properties
@@ -0,0 +1,15 @@
+# Spring boot application
+spring.application.name=product-rest
+# Base packages to scan Dubbo Component: @com.alibaba.dubbo.config.annotation.Service
+dubbo.scan.base-packages=cn.iocoder.mall.product.service
+
+# Dubbo Protocol
+dubbo.protocol.name=dubbo
+## Random port
+dubbo.protocol.port=-1
+
+## Dubbo Registry
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+
+## DemoService version
+demo.service.version=1.0.0
\ No newline at end of file
diff --git a/product/product-service-api/pom.xml b/product/product-service-api/pom.xml
new file mode 100644
index 000000000..e85bd9c75
--- /dev/null
+++ b/product/product-service-api/pom.xml
@@ -0,0 +1,14 @@
+
+
+
+ product
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ product-service-api
+
+
\ No newline at end of file
diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/service/api/ProductSpuService.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/service/api/ProductSpuService.java
new file mode 100644
index 000000000..5529bfeaa
--- /dev/null
+++ b/product/product-service-api/src/main/java/cn/iocoder/mall/product/service/api/ProductSpuService.java
@@ -0,0 +1,4 @@
+package cn.iocoder.mall.product.service.api;
+
+public interface ProductSpuService {
+}