From 39ca191d6b9367be8e6054da932c0b504ac83364 Mon Sep 17 00:00:00 2001
From: xiaoyekanren <876670773@qq.com>
Date: Tue, 24 Jun 2025 17:12:43 +0800
Subject: [PATCH 1/4] update mybatisplus
---
.../{readme.md => README.md} | 0
examples/mybatisplus-generator/pom.xml | 94 ++++++++++---------
.../src/main/java/org/apache/iotdb/Main.java | 36 +++++--
.../src/main/resources/application.yml | 6 ++
.../org/apache/iotdb/ApplicationTest.java | 20 ++++
5 files changed, 105 insertions(+), 51 deletions(-)
rename examples/mybatisplus-generator/{readme.md => README.md} (100%)
create mode 100644 examples/mybatisplus-generator/src/main/resources/application.yml
create mode 100644 examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
diff --git a/examples/mybatisplus-generator/readme.md b/examples/mybatisplus-generator/README.md
similarity index 100%
rename from examples/mybatisplus-generator/readme.md
rename to examples/mybatisplus-generator/README.md
diff --git a/examples/mybatisplus-generator/pom.xml b/examples/mybatisplus-generator/pom.xml
index 6c754799..5f42dc2c 100644
--- a/examples/mybatisplus-generator/pom.xml
+++ b/examples/mybatisplus-generator/pom.xml
@@ -21,16 +21,19 @@
-->
4.0.0
-
- org.apache.iotdb
- iotdb-extras-parent
- 2.0.4-SNAPSHOT
- ../../pom.xml
-
+
+
+
+
+
+
+
+
org.apache.iotdb
mybatisplus-generator-example
IoTDB: Example: Mybatis Plus Generator
2.0.4-SNAPHOT
+
3.5.10
17
@@ -38,13 +41,11 @@
UTF-8
3.4.5
6.2.6
+ 2.0.4-SNAPSHOT
+ 3.0.0
+
-
- org.mybatis
- mybatis
- 3.5.19
-
com.baomidou
mybatis-plus-spring-boot3-starter
@@ -53,17 +54,13 @@
com.baomidou
mybatis-plus-generator
- 3.5.10
-
-
- org.apache.velocity
- velocity-engine-core
- 2.4.1
+ ${mybatisplus.version}
+
org.apache.iotdb
iotdb-jdbc
- ${iotdb.version}
+ ${iotdb-jdbc.version}
org.springframework.boot
@@ -76,44 +73,55 @@
${spring-boot.version}
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
- 2.8.6
+ org.springframework.boot
+ spring-boot-starter-test
+ ${spring-boot.version}
+ test
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${io-springfox.version}
+
+ io.springfox
+ springfox-swagger-ui
+ ${io-springfox.version}
+
+
org.projectlombok
lombok
1.18.36
+
+ com.github.jeffreyning
+ mybatisplus-plus
+ 1.7.5-RELEASE
+
+
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
-
- org.apache.iotdb:isession
-
-
-
- com.baomidou:mybatis-plus-spring-boot3-starter
- org.apache.velocity:velocity-engine-core
- org.springframework.boot:spring-boot-starter
- org.springframework.boot:spring-boot-starter-web
- org.springdoc:springdoc-openapi-starter-webmvc-ui
- org.projectlombok:lombok
-
-
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
+ org.mybatis.generator
+ mybatis-generator-maven-plugin
+ 1.4.2
+
+
+ org.apache.iotdb
+ mybatis-generator-plugin
+ 2.0.2-SNAPSHOT
+
+
- true
+ true
+ true
+ src/main/resources/generatorConfig.xml
+
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/Main.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/Main.java
index bb98fbdb..6d836872 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/Main.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/Main.java
@@ -19,21 +19,26 @@
package org.apache.iotdb;
-import org.apache.iotdb.jdbc.IoTDBDataSource;
-
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
+import org.apache.iotdb.jdbc.IoTDBDataSource;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.sql.Types;
import java.util.Collections;
+@SpringBootApplication
+@MapperScan("org.apache.iotdb.mapper")
public class Main {
public static void main(String[] args) {
+ SpringApplication.run(Main.class, args);
IoTDBDataSource dataSource = new IoTDBDataSource();
- dataSource.setUrl("jdbc:iotdb://127.0.0.1:6667/test?sql_dialect=table");
+ dataSource.setUrl("jdbc:iotdb://127.0.0.1:6667/database1?sql_dialect=table");
dataSource.setUser("root");
dataSource.setPassword("root");
FastAutoGenerator generator =
@@ -47,7 +52,7 @@ public static void main(String[] args) {
.author("IoTDB")
.enableSwagger()
.dateType(DateType.ONLY_DATE)
- .outputDir("/apache/iotdb-extras/examples/mybatisplus-generator/src/main/java/");
+ .outputDir("src/main/java");
})
.packageConfig(
builder -> {
@@ -56,8 +61,7 @@ public static void main(String[] args) {
.mapper("mapper")
.pathInfo(
Collections.singletonMap(
- OutputFile.xml,
- "/apache/iotdb-extras/examples/mybatisplus-generator/src/main/java/"));
+ OutputFile.xml, "src/main/java/org/apache/iotdb/xml"));
})
.dataSourceConfig(
builder -> {
@@ -74,11 +78,27 @@ public static void main(String[] args) {
})
.strategyConfig(
builder -> {
- builder.addInclude("mix");
+ builder.addInclude("table1");
+ builder
+ .entityBuilder()
+ .enableLombok()
+ // .addIgnoreColumns("create_time")
+ .enableFileOverride();
+ builder
+ .serviceBuilder()
+ .formatServiceFileName("%sService")
+ .formatServiceImplFileName("%sServiceImpl")
+ .convertServiceFileName((entityName -> entityName + "Service"))
+ .enableFileOverride();
+ builder.controllerBuilder().enableRestStyle().enableFileOverride();
+ })
+ .strategyConfig(
+ builder -> {
+ builder.addInclude("table2");
builder
.entityBuilder()
.enableLombok()
- .addIgnoreColumns("create_time")
+ // .addIgnoreColumns("create_time")
.enableFileOverride();
builder
.serviceBuilder()
diff --git a/examples/mybatisplus-generator/src/main/resources/application.yml b/examples/mybatisplus-generator/src/main/resources/application.yml
new file mode 100644
index 00000000..dea27c35
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/resources/application.yml
@@ -0,0 +1,6 @@
+spring:
+ datasource:
+ url: jdbc:iotdb://127.0.0.1:6667/database1?sql_dialect=table
+ username: root
+ password: root
+ driver-class-name: org.apache.iotdb.jdbc.IoTDBDriver
diff --git a/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java b/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
new file mode 100644
index 00000000..42cca3f2
--- /dev/null
+++ b/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
@@ -0,0 +1,20 @@
+package org.apache.iotdb;
+
+import com.example.service.Table1Service;
+import com.example.service.Table2Service;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class ApplicationTest {
+ @Autowired private Table1Service table1Service;
+ @Autowired private Table2Service table2Service;
+
+ @Test
+ void contextLoads() {
+ // 启动Spring容器,验证主流程无异常
+ System.out.println("Table1 查询结果:" + table1Service.list());
+ System.out.println("Table2 查询结果:" + table2Service.list());
+ }
+}
From 52e523001a0bae2b4d1f5d06d343f9a4dc701596 Mon Sep 17 00:00:00 2001
From: xiaoyekanren <876670773@qq.com>
Date: Tue, 24 Jun 2025 18:06:16 +0800
Subject: [PATCH 2/4] update mybatis-plus
---
examples/mybatisplus-generator/README.md | 239 +++++++++++-------
.../iotdb/controller/Table1Controller.java | 18 ++
.../iotdb/controller/Table2Controller.java | 18 ++
.../java/org/apache/iotdb/entity/Table1.java | 57 +++++
.../java/org/apache/iotdb/entity/Table2.java | 57 +++++
.../org/apache/iotdb/mapper/Table1Mapper.java | 18 ++
.../org/apache/iotdb/mapper/Table2Mapper.java | 18 ++
.../apache/iotdb/service/Table1Service.java | 16 ++
.../apache/iotdb/service/Table2Service.java | 16 ++
.../iotdb/service/impl/Table1ServiceImpl.java | 20 ++
.../iotdb/service/impl/Table2ServiceImpl.java | 20 ++
.../org/apache/iotdb/xml/Table1Mapper.xml | 5 +
.../org/apache/iotdb/xml/Table2Mapper.xml | 5 +
.../org/apache/iotdb/ApplicationTest.java | 4 +-
14 files changed, 416 insertions(+), 95 deletions(-)
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml
create mode 100644 examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml
diff --git a/examples/mybatisplus-generator/README.md b/examples/mybatisplus-generator/README.md
index 4ed72118..8b01b076 100644
--- a/examples/mybatisplus-generator/README.md
+++ b/examples/mybatisplus-generator/README.md
@@ -21,108 +21,161 @@
# MybatisPlus-Generator Demo
## Introduction
- This demo shows how to use IoTDB-MybatisPlus-Generator
+This demo shows how to use IoTDB-MybatisPlus-Generator
### Version usage
- IoTDB: 2.0.1-beta
- mybatisPlus: 3.5.10
+IoTDB: 2.0.1-beta
+mybatisPlus: 3.5.10
### 1. Install IoTDB
- please refer to [https://iotdb.apache.org/#/Download](https://iotdb.apache.org/#/Download)
+please refer to [https://iotdb.apache.org/#/Download](https://iotdb.apache.org/#/Download)
### 2. Startup IoTDB
- please refer to [Quick Start](http://iotdb.apache.org/UserGuide/Master/Get%20Started/QuickStart.html)
-
- Then we need to create a database 'test' by cli in table model
- ```
- create database test;
- use test;
- ```
- Then we need to create a database 'table'
- ```
- CREATE TABLE mix (
- time TIMESTAMP TIME,
- region STRING TAG,
- plant_id STRING TAG,
- device_id STRING TAG,
- model_id STRING ATTRIBUTE,
- maintenance STRING ATTRIBUTE,
- temperature FLOAT FIELD,
- humidity FLOAT FIELD,
- status Boolean FIELD,
- arrival_time TIMESTAMP FIELD
- ) WITH (TTL=31536000000);
- ```
+please refer to [Quick Start](http://iotdb.apache.org/UserGuide/Master/Get%20Started/QuickStart.html)
+
+Then we need to create a database 'test' by cli in table model
+```
+create database test;
+use test;
+```
+Then we need to create a database 'table'
+```sql
+CREATE TABLE mix (
+ time TIMESTAMP TIME,
+ region STRING TAG,
+ plant_id STRING TAG,
+ device_id STRING TAG,
+ model_id STRING ATTRIBUTE,
+ maintenance STRING ATTRIBUTE,
+ temperature FLOAT FIELD,
+ humidity FLOAT FIELD,
+ status Boolean FIELD,
+ arrival_time TIMESTAMP FIELD
+) WITH (TTL=31536000000);
+```
### 3. Build Dependencies with Maven in your Project
- ```
-
-
- com.baomidou
- mybatis-plus-spring-boot3-starter
- 3.5.10
-
-
-
- com.baomidou
- mybatis-plus-generator
- 3.5.10
-
-
-
- org.apache.velocity
- velocity-engine-core
- 2.0
-
-
-
- org.apache.iotdb
- iotdb-jdbc
- 2.0.2
-
-
- org.springframework.boot
- spring-boot-starter
- 3.4.3
-
-
- org.springframework.boot
- spring-boot-starter-web
- 3.4.3
-
-
- io.springfox
- springfox-swagger2
- 3.0.0
-
-
- io.springfox
- springfox-swagger-ui
- 3.0.0
-
-
- org.projectlombok
- lombok
- 1.18.36
-
-
- ```
-
-### 5. Start the Main.java
-
-### 6、the target file location
-
- You can see the target file in your Project
- ```
- org/apache/iotdb/controller/MixController.java
- org/apache/iotdb/entity/Mix.java
- org/apache/iotdb/mapper/MixMapper.xml
- org/apache/iotdb/service/MixService.java
- org/apache/iotdb/service/MixServiceImpl.java
- org/apache/iotdb/MixMapper.xml
-
- ```
+```
+
+ 3.5.10
+ 17
+ 17
+ UTF-8
+ 3.4.5
+ 6.2.6
+ 2.0.4-SNAPSHOT
+ 3.0.0
+
+
+
+
+ com.baomidou
+ mybatis-plus-spring-boot3-starter
+ ${mybatisplus.version}
+
+
+ com.baomidou
+ mybatis-plus-generator
+ ${mybatisplus.version}
+
+
+
+ org.apache.iotdb
+ iotdb-jdbc
+ ${iotdb-jdbc.version}
+
+
+ org.springframework.boot
+ spring-boot-starter
+ ${spring-boot.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${spring-boot.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ ${spring-boot.version}
+ test
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${io-springfox.version}
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${io-springfox.version}
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.36
+
+
+ com.github.jeffreyning
+ mybatisplus-plus
+ 1.7.5-RELEASE
+
+
+```
+
+### 4. Start the Main.java
+
+### 5. the target file location
+
+You can see the target file in your Project
+```
+org/apache/iotdb/controller/MixController.java
+org/apache/iotdb/entity/Mix.java
+org/apache/iotdb/mapper/MixMapper.xml
+org/apache/iotdb/service/MixService.java
+org/apache/iotdb/service/MixServiceImpl.java
+org/apache/iotdb/MixMapper.xml
+
+```
+
+### 6. add & alter Annotations
+
+The generated code files `entity/Table1.java` and `entity/Table2.java` need to be manually adjusted to support multi-primary key queries.
+
+```java
+// add import
+import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
+
+// add @MppMultiId
+@MppMultiId
+// alter @TableId() -->> @TableField()
+@TableField("time")
+private Date time;
+
+// add @MppMultiId
+@MppMultiId
+// alter @TableId() -->> @TableField()
+@TableField("region")
+private String region;
+
+// add @MppMultiId
+@MppMultiId
+// alter @TableId() -->> @TableField()
+@TableField("plant_id")
+private String plantId;
+
+// add @MppMultiId
+@MppMultiId
+// alter @TableId() -->> @TableField()
+@TableField("device_id")
+private String deviceId;
+//
+
+```
+
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java
new file mode 100644
index 00000000..d6993e15
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java
@@ -0,0 +1,18 @@
+package org.apache.iotdb.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@RestController
+@RequestMapping("/table1")
+public class Table1Controller {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java
new file mode 100644
index 00000000..265a11a2
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java
@@ -0,0 +1,18 @@
+package org.apache.iotdb.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@RestController
+@RequestMapping("/table2")
+public class Table2Controller {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java
new file mode 100644
index 00000000..db214af5
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java
@@ -0,0 +1,57 @@
+package org.apache.iotdb.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ *
+ *
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@Getter
+@Setter
+@ToString
+@ApiModel(value = "Table1对象", description = "")
+public class Table1 implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @MppMultiId
+ @TableField("time")
+ private Date time;
+
+ @MppMultiId
+ @TableField("region")
+ private String region;
+
+ @MppMultiId
+ @TableField("plant_id")
+ private String plantId;
+
+ @MppMultiId
+ @TableField("device_id")
+ private String deviceId;
+
+ private String modelId;
+
+ private String maintenance;
+
+ private Float temperature;
+
+ private Float humidity;
+
+ private Boolean status;
+
+ private Date arrivalTime;
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java
new file mode 100644
index 00000000..24b7ae67
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java
@@ -0,0 +1,57 @@
+package org.apache.iotdb.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ *
+ *
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@Getter
+@Setter
+@ToString
+@ApiModel(value = "Table2对象", description = "")
+public class Table2 implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @MppMultiId
+ @TableField("time")
+ private Date time;
+
+ @MppMultiId
+ @TableField("region")
+ private String region;
+
+ @MppMultiId
+ @TableField("plant_id")
+ private String plantId;
+
+ @MppMultiId
+ @TableField("device_id")
+ private String deviceId;
+
+ private String modelId;
+
+ private String maintenance;
+
+ private Float temperature;
+
+ private Float humidity;
+
+ private Boolean status;
+
+ private Date arrivalTime;
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java
new file mode 100644
index 00000000..c4d55265
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java
@@ -0,0 +1,18 @@
+package org.apache.iotdb.mapper;
+
+import org.apache.iotdb.entity.Table1;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table1Mapper extends BaseMapper {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java
new file mode 100644
index 00000000..4eb97936
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java
@@ -0,0 +1,18 @@
+package org.apache.iotdb.mapper;
+
+import org.apache.iotdb.entity.Table2;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table2Mapper extends BaseMapper {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java
new file mode 100644
index 00000000..401842c7
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java
@@ -0,0 +1,16 @@
+package org.apache.iotdb.service;
+
+import org.apache.iotdb.entity.Table1;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table1Service extends IService {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java
new file mode 100644
index 00000000..0c20d599
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java
@@ -0,0 +1,16 @@
+package org.apache.iotdb.service;
+
+import org.apache.iotdb.entity.Table2;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table2Service extends IService {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java
new file mode 100644
index 00000000..30fda764
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java
@@ -0,0 +1,20 @@
+package org.apache.iotdb.service.impl;
+
+import org.apache.iotdb.entity.Table1;
+import org.apache.iotdb.mapper.Table1Mapper;
+import org.apache.iotdb.service.Table1Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 服务实现类
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@Service
+public class Table1ServiceImpl extends ServiceImpl implements Table1Service {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java
new file mode 100644
index 00000000..9c589a2d
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java
@@ -0,0 +1,20 @@
+package org.apache.iotdb.service.impl;
+
+import org.apache.iotdb.entity.Table2;
+import org.apache.iotdb.mapper.Table2Mapper;
+import org.apache.iotdb.service.Table2Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 服务实现类
+ *
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@Service
+public class Table2ServiceImpl extends ServiceImpl implements Table2Service {
+
+}
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml
new file mode 100644
index 00000000..46b4b74f
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml
new file mode 100644
index 00000000..ffd3bbd3
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java b/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
index 42cca3f2..3cfb07eb 100644
--- a/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
+++ b/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
@@ -1,7 +1,7 @@
package org.apache.iotdb;
-import com.example.service.Table1Service;
-import com.example.service.Table2Service;
+import org.apache.iotdb.service.Table1Service;
+import org.apache.iotdb.service.Table2Service;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
From 61b670aa6a5a0ab5a41d30c38e36b04712aec9cc Mon Sep 17 00:00:00 2001
From: xiaoyekanren <876670773@qq.com>
Date: Tue, 24 Jun 2025 18:09:45 +0800
Subject: [PATCH 3/4] uncomment parent
---
examples/mybatisplus-generator/pom.xml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/examples/mybatisplus-generator/pom.xml b/examples/mybatisplus-generator/pom.xml
index 5f42dc2c..859a3af6 100644
--- a/examples/mybatisplus-generator/pom.xml
+++ b/examples/mybatisplus-generator/pom.xml
@@ -22,12 +22,12 @@
4.0.0
-
-
-
-
-
-
+
+ org.apache.iotdb
+ iotdb-extras-parent
+ 2.0.4-SNAPSHOT
+ ../../pom.xml
+
org.apache.iotdb
mybatisplus-generator-example
From c3f6201f33cc864bc6cee97ac05aa609c089ec98 Mon Sep 17 00:00:00 2001
From: xiaoyekanren <876670773@qq.com>
Date: Tue, 24 Jun 2025 18:30:14 +0800
Subject: [PATCH 4/4] add licenses
---
.../iotdb/controller/Table1Controller.java | 19 ++++++++++++++++++
.../iotdb/controller/Table2Controller.java | 19 ++++++++++++++++++
.../java/org/apache/iotdb/entity/Table1.java | 19 ++++++++++++++++++
.../java/org/apache/iotdb/entity/Table2.java | 19 ++++++++++++++++++
.../org/apache/iotdb/mapper/Table1Mapper.java | 19 ++++++++++++++++++
.../org/apache/iotdb/mapper/Table2Mapper.java | 19 ++++++++++++++++++
.../apache/iotdb/service/Table1Service.java | 19 ++++++++++++++++++
.../apache/iotdb/service/Table2Service.java | 19 ++++++++++++++++++
.../iotdb/service/impl/Table1ServiceImpl.java | 19 ++++++++++++++++++
.../iotdb/service/impl/Table2ServiceImpl.java | 19 ++++++++++++++++++
.../org/apache/iotdb/xml/Table1Mapper.xml | 20 +++++++++++++++++++
.../org/apache/iotdb/xml/Table2Mapper.xml | 20 +++++++++++++++++++
.../src/main/resources/application.yml | 17 ++++++++++++++++
.../org/apache/iotdb/ApplicationTest.java | 19 ++++++++++++++++++
14 files changed, 266 insertions(+)
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java
index d6993e15..be29a047 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.controller;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java
index 265a11a2..2db29da2 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.controller;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java
index db214af5..04cc32af 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java
index 24b7ae67..1f77f6e5 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.entity;
import com.baomidou.mybatisplus.annotation.TableField;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java
index c4d55265..a5ca7618 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.mapper;
import org.apache.iotdb.entity.Table1;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java
index 4eb97936..faf822bc 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.mapper;
import org.apache.iotdb.entity.Table2;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java
index 401842c7..cdfa50b4 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.service;
import org.apache.iotdb.entity.Table1;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java
index 0c20d599..2ec735bd 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.service;
import org.apache.iotdb.entity.Table2;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java
index 30fda764..d712f15a 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.service.impl;
import org.apache.iotdb.entity.Table1;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java
index 9c589a2d..b9bff35c 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb.service.impl;
import org.apache.iotdb.entity.Table2;
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml
index 46b4b74f..7e073ed5 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml
@@ -1,4 +1,24 @@
+
diff --git a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml
index ffd3bbd3..5a8a6e32 100644
--- a/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml
+++ b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml
@@ -1,4 +1,24 @@
+
diff --git a/examples/mybatisplus-generator/src/main/resources/application.yml b/examples/mybatisplus-generator/src/main/resources/application.yml
index dea27c35..bdf355a3 100644
--- a/examples/mybatisplus-generator/src/main/resources/application.yml
+++ b/examples/mybatisplus-generator/src/main/resources/application.yml
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
spring:
datasource:
url: jdbc:iotdb://127.0.0.1:6667/database1?sql_dialect=table
diff --git a/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java b/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
index 3cfb07eb..b368f3b0 100644
--- a/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
+++ b/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
package org.apache.iotdb;
import org.apache.iotdb.service.Table1Service;