初始化项目结构(未完成)

This commit is contained in:
YunaiV 2019-02-21 20:12:29 +08:00
commit 85846516f1
23 changed files with 613 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -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/

21
pom.xml Normal file
View File

@ -0,0 +1,21 @@
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>product</module>
</modules>
<packaging>pom</packaging>
</project>

21
product/pom.xml Normal file
View File

@ -0,0 +1,21 @@
<?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">
<parent>
<artifactId>mall-parent</artifactId>
<groupId>cn.iocoder.mall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product</artifactId>
<packaging>pom</packaging>
<modules>
<module>product-application</module>
<module>product-service</module>
<module>product-service-api</module>
</modules>
</project>

View File

@ -0,0 +1,52 @@
<?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">
<parent>
<artifactId>product</artifactId>
<groupId>cn.iocoder.mall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-rest</artifactId>
<dependencies>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>product-service-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.5</version>
</dependency>
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>2.12.0</version>
</dependency>
</dependencies>
</project>

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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<ProductCategoryVO> list(@RequestParam("id") Integer id) {
return new ArrayList<>();
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -0,0 +1,4 @@
package cn.iocoder.mall.product.vo;
public class ProductCategoryVO {
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.mall.product.vo;
import java.util.List;
public class ProductSpuListVO {
/**
* SPU 数组
*/
private List<ProductSpuVO> list;
/**
* 是否还有下一页
*/
private Boolean hasNext;
}

View File

@ -0,0 +1,4 @@
package cn.iocoder.mall.product.vo;
public class ProductSpuVO {
}

View File

@ -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

View File

@ -0,0 +1,14 @@
<?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">
<parent>
<artifactId>product</artifactId>
<groupId>cn.iocoder.mall</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-service-api</artifactId>
</project>

View File

@ -0,0 +1,4 @@
package cn.iocoder.mall.product.service.api;
public interface ProductSpuService {
}