File tree Expand file tree Collapse file tree 8 files changed +210
-0
lines changed
src/main/java/com/wdbyte/entity Expand file tree Collapse file tree 8 files changed +210
-0
lines changed Original file line number Diff line number Diff line change 1+ HELP.md
2+ target /
3+ ! .mvn /wrapper /maven-wrapper.jar
4+ ! ** /src /main /**
5+ ! ** /src /test /**
6+
7+ # ## STS ###
8+ .apt_generated
9+ .classpath
10+ .factorypath
11+ .project
12+ .settings
13+ .springBeans
14+ .sts4-cache
15+
16+ # ## IntelliJ IDEA ###
17+ .idea
18+ * .iws
19+ * .iml
20+ * .ipr
21+
22+ # ## NetBeans ###
23+ /nbproject /private /
24+ /nbbuild /
25+ /dist /
26+ /nbdist /
27+ /.nb-gradle /
28+ build /
29+
30+ # ## VS Code ###
31+ .vscode /
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <packaging >pom</packaging >
6+ <modules >
7+ <module >product-common</module >
8+ <module >product-web</module >
9+ </modules >
10+ <parent >
11+ <groupId >org.springframework.boot</groupId >
12+ <artifactId >spring-boot-starter-parent</artifactId >
13+ <version >2.2.5.RELEASE</version >
14+ <relativePath /> <!-- lookup parent from repository -->
15+ </parent >
16+ <groupId >com.wdbyte</groupId >
17+ <artifactId >springboot-module-demo</artifactId >
18+ <version >0.0.1-SNAPSHOT</version >
19+ <name >springboot-module-demo</name >
20+ <description >Demo project for Spring Boot</description >
21+
22+ <properties >
23+ <java .version>1.8</java .version>
24+ <product-common .version>0.0.1-SNAPSHOT</product-common .version>
25+ </properties >
26+
27+ <dependencyManagement >
28+ <dependencies >
29+ <dependency >
30+ <groupId >com.wdbyte</groupId >
31+ <artifactId >product-common</artifactId >
32+ <version >${product-common.version} </version >
33+ </dependency >
34+ </dependencies >
35+ </dependencyManagement >
36+
37+ </project >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <parent >
6+ <artifactId >springboot-module-demo</artifactId >
7+ <groupId >com.wdbyte</groupId >
8+ <version >0.0.1-SNAPSHOT</version >
9+ </parent >
10+ <modelVersion >4.0.0</modelVersion >
11+ <artifactId >product-common</artifactId >
12+ <dependencies >
13+ <dependency >
14+ <groupId >org.projectlombok</groupId >
15+ <artifactId >lombok</artifactId >
16+ <optional >true</optional >
17+ </dependency >
18+ </dependencies >
19+ </project >
Original file line number Diff line number Diff line change 1+ package com .wdbyte .entity ;
2+
3+ import lombok .Data ;
4+
5+ import java .math .BigDecimal ;
6+
7+ /**
8+ * <p>
9+ *
10+ * @author niujinpeng
11+ * @Date 2020/3/17 22:21
12+ */
13+ @ Data
14+ public class Product {
15+ /** 商品名称. */
16+ private String productName ;
17+ /** 商品价格. */
18+ private BigDecimal productPrice ;
19+ /** 商品库存。 */
20+ private int productStock ;
21+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <parent >
6+ <artifactId >springboot-module-demo</artifactId >
7+ <groupId >com.wdbyte</groupId >
8+ <version >0.0.1-SNAPSHOT</version >
9+ </parent >
10+ <modelVersion >4.0.0</modelVersion >
11+ <artifactId >product-web</artifactId >
12+
13+ <dependencies >
14+ <dependency >
15+ <groupId >com.wdbyte</groupId >
16+ <artifactId >product-common</artifactId >
17+ </dependency >
18+
19+ <dependency >
20+ <groupId >org.springframework.boot</groupId >
21+ <artifactId >spring-boot-starter-web</artifactId >
22+ </dependency >
23+
24+ <dependency >
25+ <groupId >org.springframework.boot</groupId >
26+ <artifactId >spring-boot-starter-test</artifactId >
27+ <scope >test</scope >
28+ <exclusions >
29+ <exclusion >
30+ <groupId >org.junit.vintage</groupId >
31+ <artifactId >junit-vintage-engine</artifactId >
32+ </exclusion >
33+ </exclusions >
34+ </dependency >
35+ </dependencies >
36+
37+
38+ <build >
39+ <plugins >
40+ <plugin >
41+ <groupId >org.springframework.boot</groupId >
42+ <artifactId >spring-boot-maven-plugin</artifactId >
43+ </plugin >
44+ </plugins >
45+ </build >
46+ </project >
Original file line number Diff line number Diff line change 1+ package com .wdbyte ;
2+
3+ import org .springframework .boot .SpringApplication ;
4+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5+
6+ @ SpringBootApplication
7+ public class Application {
8+
9+ public static void main (String [] args ) {
10+ SpringApplication .run (Application .class , args );
11+ }
12+
13+ }
Original file line number Diff line number Diff line change 1+ package com .wdbyte .controller ;
2+
3+ import java .math .BigDecimal ;
4+ import java .util .Arrays ;
5+ import java .util .HashMap ;
6+ import java .util .Map ;
7+
8+ import com .wdbyte .entity .Product ;
9+ import org .springframework .web .bind .annotation .GetMapping ;
10+ import org .springframework .web .bind .annotation .RequestMapping ;
11+ import org .springframework .web .bind .annotation .RestController ;
12+
13+ /**
14+ * <p>
15+ *
16+ * @author niujinpeng
17+ * @Date 2020/3/17 22:23
18+ */
19+ @ RestController
20+ @ RequestMapping ("/product" )
21+ public class ProductController {
22+
23+ /**
24+ * 获取商品列表
25+ *
26+ * @return
27+ */
28+ @ GetMapping ("/list" )
29+ public Map list () {
30+ // 模拟查询逻辑
31+ Product product = new Product ();
32+ product .setProductName ("小米粥" );
33+ product .setProductPrice (new BigDecimal (2.0 ));
34+ product .setProductStock (100 );
35+
36+ Map <String , Object > resultMap = new HashMap <>();
37+ resultMap .put ("code" , 000 );
38+ resultMap .put ("message" , "成功" );
39+ resultMap .put ("data" , Arrays .asList (product ));
40+ return resultMap ;
41+ }
42+ }
Original file line number Diff line number Diff line change 1+
You can’t perform that action at this time.
0 commit comments