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

pull/1/head
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*80015
*/
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 {
}