Skip to content

Commit 8b854ed

Browse files
committed
Merge branch 'main' into gmain
2 parents 9a9fec6 + 7017134 commit 8b854ed

File tree

25 files changed

+1284
-0
lines changed

25 files changed

+1284
-0
lines changed

‎04fx/dtx01/pom.xml‎

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectxmlns="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+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>2.0.9.RELEASE</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
11+
<groupId>io.kimmking</groupId>
12+
<artifactId>dtx01</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<name>dtx01</name>
15+
<description>Demo project for Spring Boot</description>
16+
17+
<properties>
18+
<java.version>1.8</java.version>
19+
</properties>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-jdbc</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter</artifactId>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-web</artifactId>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.mybatis.spring.boot</groupId>
36+
<artifactId>mybatis-spring-boot-starter</artifactId>
37+
<version>2.1.4</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>mysql</groupId>
41+
<artifactId>mysql-connector-java</artifactId>
42+
<version>5.1.47</version>
43+
</dependency>
44+
45+
<dependency>
46+
<groupId>org.apache.dubbo</groupId>
47+
<artifactId>dubbo</artifactId>
48+
<version>2.7.8</version>
49+
</dependency>
50+
51+
<dependency>
52+
<groupId>org.projectlombok</groupId>
53+
<artifactId>lombok</artifactId>
54+
</dependency>
55+
<!-- <dependency>-->
56+
<!-- <groupId>org.springframework.boot</groupId>-->
57+
<!-- <artifactId>spring-boot-starter-cache</artifactId>-->
58+
<!-- </dependency>-->
59+
<!-- <dependency>-->
60+
<!-- <groupId>org.springframework.boot</groupId>-->
61+
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
62+
<!-- </dependency>-->
63+
<!-- <dependency>-->
64+
<!-- <groupId>io.lettuce</groupId>-->
65+
<!-- <artifactId>lettuce-core</artifactId>-->
66+
<!-- </dependency>-->
67+
<!-- <dependency>-->
68+
<!-- <groupId>org.apache.commons</groupId>-->
69+
<!-- <artifactId>commons-pool2</artifactId>-->
70+
<!-- </dependency>-->
71+
<!-- <dependency>-->
72+
<!-- <groupId>net.sf.ehcache</groupId>-->
73+
<!-- <artifactId>ehcache</artifactId>-->
74+
<!-- <version>2.8.3</version>-->
75+
<!-- </dependency>-->
76+
<!-- <dependency>-->
77+
<!-- <groupId>org.mybatis</groupId>-->
78+
<!-- <artifactId>mybatis-ehcache</artifactId>-->
79+
<!-- <version>1.0.0</version>-->
80+
<!-- </dependency>-->
81+
82+
<dependency>
83+
<groupId>org.springframework.boot</groupId>
84+
<artifactId>spring-boot-starter-test</artifactId>
85+
<scope>test</scope>
86+
<exclusions>
87+
<exclusion>
88+
<groupId>org.junit.vintage</groupId>
89+
<artifactId>junit-vintage-engine</artifactId>
90+
</exclusion>
91+
</exclusions>
92+
</dependency>
93+
94+
<!-- <dependency>-->
95+
<!-- <groupId>io.seata</groupId>-->
96+
<!-- <artifactId>seata-all</artifactId>-->
97+
<!-- <version>1.4.2</version>-->
98+
<!-- </dependency>-->
99+
100+
<!-- <dependency>-->
101+
<!-- <groupId>org.dromara</groupId>-->
102+
<!-- <artifactId>hmily-annotation</artifactId>-->
103+
<!-- <version>2.1.1</version>-->
104+
<!-- </dependency>-->
105+
106+
</dependencies>
107+
108+
<build>
109+
<plugins>
110+
<plugin>
111+
<groupId>org.springframework.boot</groupId>
112+
<artifactId>spring-boot-maven-plugin</artifactId>
113+
</plugin>
114+
</plugins>
115+
</build>
116+
117+
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
packageio.kimmking.dtx01;
2+
3+
importorg.mybatis.spring.annotation.MapperScan;
4+
importorg.springframework.boot.SpringApplication;
5+
importorg.springframework.boot.autoconfigure.SpringBootApplication;
6+
importorg.springframework.cache.annotation.EnableCaching;
7+
8+
@SpringBootApplication(scanBasePackages = "io.kimmking.dtx01")
9+
@MapperScan("io.kimmking.dtx01.mapper")
10+
@EnableCaching
11+
publicclassDtx01Application{
12+
13+
publicstaticvoidmain(String[] args){
14+
SpringApplication.run(Dtx01Application.class, args);
15+
}
16+
17+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
packageio.kimmking.dtx01.controller;
2+
3+
importio.kimmking.dtx01.entity.User;
4+
importio.kimmking.dtx01.service.UserService;
5+
importorg.springframework.beans.factory.annotation.Autowired;
6+
importorg.springframework.boot.autoconfigure.EnableAutoConfiguration;
7+
importorg.springframework.web.bind.annotation.RequestMapping;
8+
importorg.springframework.web.bind.annotation.RestController;
9+
10+
importjava.util.List;
11+
12+
@RestController
13+
@EnableAutoConfiguration
14+
publicclassUserController{
15+
16+
@Autowired
17+
UserServiceuserService;
18+
19+
@RequestMapping("/user/find")
20+
Userfind(Longid){
21+
returnuserService.find(id);
22+
//return new User(1,"KK", 28);
23+
}
24+
25+
@RequestMapping("/user/list")
26+
List<User> list(){
27+
returnuserService.list();
28+
// return Arrays.asList(new User(1,"KK", 28),
29+
// new User(2,"CC", 18));
30+
}
31+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
packageio.kimmking.dtx01.entity;
2+
3+
importlombok.AllArgsConstructor;
4+
importlombok.Data;
5+
importlombok.NoArgsConstructor;
6+
7+
importjava.io.Serializable;
8+
9+
@Data
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
publicclassUserimplementsSerializable{
13+
privateLongid;
14+
privateStringname;
15+
privateIntegerage;
16+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
packageio.kimmking.dtx01.mapper;
2+
3+
importio.kimmking.dtx01.entity.User;
4+
importorg.apache.ibatis.annotations.Param;
5+
importorg.apache.ibatis.annotations.Select;
6+
importorg.springframework.stereotype.Repository;
7+
8+
importjava.util.List;
9+
10+
@Repository
11+
publicinterfaceUserMapper{
12+
13+
@Select("select * from user where id = #{id};")
14+
Userfind(@Param("id") Longid);
15+
16+
@Select("select * from user;")
17+
List<User> list();
18+
19+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
packageio.kimmking.dtx01.service;
2+
3+
importio.kimmking.dtx01.entity.User;
4+
5+
importjava.util.List;
6+
7+
publicinterfaceUserService{
8+
9+
Userfind(Longid);
10+
11+
List<User> list();
12+
13+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
packageio.kimmking.dtx01.service;
2+
3+
importio.kimmking.dtx01.entity.User;
4+
importio.kimmking.dtx01.mapper.UserMapper;
5+
importorg.springframework.beans.factory.annotation.Autowired;
6+
importorg.springframework.stereotype.Service;
7+
8+
importjava.util.List;
9+
10+
@Service
11+
publicclassUserServiceImplimplementsUserService{
12+
13+
@Autowired
14+
UserMapperuserMapper; //DAO // Repository
15+
16+
publicUserfind(Longid){
17+
System.out.println(" ==> find " + id);
18+
returnuserMapper.find(id);
19+
}
20+
21+
publicList<User> list(){
22+
returnuserMapper.list();
23+
}
24+
25+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
server:
2+
port: 8080
3+
4+
spring:
5+
datasource:
6+
username: root
7+
password:
8+
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false
9+
driver-class-name: com.mysql.jdbc.Driver
10+
# cache:
11+
# type: redis
12+
# redis:
13+
# host: localhost
14+
# lettuce:
15+
# pool:
16+
# max-active: 16
17+
# max-wait: 10ms
18+
19+
# type: ehcache
20+
# ehcache:
21+
# config: ehcache.xml
22+
23+
#mybatis:
24+
# mapper-locations: classpath:mapper/*Mapper.xml
25+
# type-aliases-package: io.kimmking.dtx01.entity
26+
27+
logging:
28+
level:
29+
io:
30+
kimmking:
31+
cache : info
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--<?xml version="1.0" encoding="UTF-8"?>-->
2+
<!--<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">-->
3+
<!--<mapper namespace="io.kimmking.dtx01.mapper.UserMapper">-->
4+
5+
<!--&lt;!&ndash; 开启mybatis cache &ndash;&gt;-->
6+
<!--&lt;!&ndash; <cache type="org.mybatis.caches.ehcache.LoggingEhcache">&ndash;&gt;-->
7+
<!--&lt;!&ndash; <property name="memoryStoreEvictionPolicy" value="LRU"/>&ndash;&gt;-->
8+
<!--&lt;!&ndash; </cache>&ndash;&gt;-->
9+
10+
<!-- <resultMap id="BaseResultMap" type="io.kimmking.dtx01.entity.User">-->
11+
<!-- <result column="id" jdbcType="INTEGER" property="id" />-->
12+
<!-- <result column="name" jdbcType="VARCHAR" property="name" />-->
13+
<!-- <result column="age" jdbcType="INTEGER" property="age" />-->
14+
<!-- </resultMap>-->
15+
16+
<!-- <select id="find" resultType="io.kimmking.dtx01.entity.User">-->
17+
<!-- select * from user where id = #{id}-->
18+
<!-- </select>-->
19+
20+
<!-- <select id="list" resultType="io.kimmking.dtx01.entity.User">-->
21+
<!-- select * from user-->
22+
<!-- </select>-->
23+
24+
<!--</mapper>-->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
packageio.kimmking.dtx01;
2+
3+
importorg.junit.Test;
4+
importorg.springframework.boot.test.context.SpringBootTest;
5+
6+
@SpringBootTest
7+
classDtx01ApplicationTests{
8+
9+
@Test
10+
voidcontextLoads(){
11+
}
12+
13+
}

0 commit comments

Comments
(0)