Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e1dadfc

Browse files
committed
feat: update README
1 parent 0286ebc commit e1dadfc

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

‎README.md‎

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,68 @@
11
# mybatis-dynamic-sql-integration-demo
2-
a sample code integration mybatis generator, mybatis dynamic sql, spring-boot
2+
3+
## Description
4+
5+
A sample code integration mybatis generator, mybatis dynamic sql, spring-boot.
6+
7+
**integration features**
8+
9+
- Generate Entity from database by run Gradle Task `dao:mybatisGenerate`
10+
- Auto migration database DDL or DML by flyway
11+
- Integration Lombok and MapStruct to simplify the code
12+
- Integration Mybatis-Dynamic-SQL and shows how write complicated DSL SQL
13+
14+
15+
16+
# Build
17+
18+
![environment](statics/build-environment.png)
19+
20+
# Run
21+
22+
1. First: modify `api/resources/application.yml`
23+
24+
```yaml
25+
spring:
26+
datasource:
27+
driver-class-name: com.mysql.cj.jdbc.Driver
28+
url: jdbc:mysql://{your database url}/{your database name}
29+
username: { your database username }
30+
password: { your database password }
31+
```
32+
33+
2. Second: modify `dao/resources/generatorConfiguration.xml`
34+
35+
```xml
36+
37+
<generatorConfiguration>
38+
39+
<context id="dsql" targetRuntime="MyBatis3DynamicSql">
40+
<!-- ...... -->
41+
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
42+
connectionURL="jdbc:mysql://{your database url}/{your database name}"
43+
userId="{your database username}"
44+
password="{your database password}"/>
45+
<!-- ...... -->
46+
</context>
47+
</generatorConfiguration>
48+
```
49+
50+
3. Run Main class `api/java/cc/cc1234/api/Application.java`
51+
52+
53+
54+
# Module
55+
56+
![module-relation](statics/module-relation.png)
57+
58+
59+
60+
## API
61+
62+
| Method | EndPoint | Request Body | Description |
63+
| ------ | -------------------------------------- | ------------------------------------- | ----------------------------- |
64+
| POST | /v1/api/user | {"username":"hello", "gender":"MALE"} | create user |
65+
| DELETE | /v1/api/users/{userId} | N/A | delete user |
66+
| PATCH | /v1/api/users/{userId} | {"username":"hello", "gender":"MALE"} | update user basic information |
67+
| GET | /v1/api/users?page=1&size=20 | N/A | list users |
68+
| GET | /v1/api/users/{userId}/goods/purchased | N/A | query user purchased goods |

‎build.gradle‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
plugins {
22
id 'java'
33
id "org.flywaydb.flyway" version "7.14.0"
4+
id 'org.springframework.boot' version '2.5.4'
45
}
56

67
allprojects {
78
version '1.0-SNAPSHOT'
89
apply plugin: 'java'
10+
apply plugin: 'io.spring.dependency-management'
911

1012
repositories {
1113
mavenCentral()

‎statics/build-environment.png‎

81.2 KB
Loading[フレーム]

‎statics/module-relation.png‎

37.6 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /