This is an automated email from the ASF dual-hosted git repository.
critas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb-extras.git
The following commit(s) were added to refs/heads/master by this push:
new a39eefa Update mybatisplus (#83)
a39eefa is described below
commit a39eefa95f0de121645db935a932a58413faa1cc
Author: 张正明 <[email protected]>
AuthorDate: Wed Jun 25 11:49:29 2025 +0800
Update mybatisplus (#83)
* update mybatisplus
* update mybatis-plus
* uncomment parent
* add licenses
---
examples/mybatisplus-generator/README.md | 181 +++++++++++++++++++++
examples/mybatisplus-generator/pom.xml | 82 +++++-----
examples/mybatisplus-generator/readme.md | 128 ---------------
.../src/main/java/org/apache/iotdb/Main.java | 36 +++-
.../apache/iotdb/controller/Table1Controller.java | 37 +++++
.../apache/iotdb/controller/Table2Controller.java | 37 +++++
.../main/java/org/apache/iotdb/entity/Table1.java | 76 +++++++++
.../main/java/org/apache/iotdb/entity/Table2.java | 76 +++++++++
.../java/org/apache/iotdb/mapper/Table1Mapper.java | 37 +++++
.../java/org/apache/iotdb/mapper/Table2Mapper.java | 37 +++++
.../org/apache/iotdb/service/Table1Service.java | 35 ++++
.../org/apache/iotdb/service/Table2Service.java | 35 ++++
.../iotdb/service/impl/Table1ServiceImpl.java | 39 +++++
.../iotdb/service/impl/Table2ServiceImpl.java | 39 +++++
.../java/org/apache/iotdb/xml/Table1Mapper.xml | 25 +++
.../java/org/apache/iotdb/xml/Table2Mapper.xml | 25 +++
.../src/main/resources/application.yml | 23 +++
.../java/org/apache/iotdb/ApplicationTest.java | 39 +++++
18 files changed, 814 insertions(+), 173 deletions(-)
diff --git a/examples/mybatisplus-generator/README.md
b/examples/mybatisplus-generator/README.md
new file mode 100644
index 0000000..8b01b07
--- /dev/null
+++ b/examples/mybatisplus-generator/README.md
@@ -0,0 +1,181 @@
+<!--
+
+ 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.
+
+-->
+# MybatisPlus-Generator Demo
+## Introduction
+
+This demo shows how to use IoTDB-MybatisPlus-Generator
+
+### Version usage
+
+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)
+
+### 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'
+```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
+
+```
+<properties>
+ <mybatisplus.version>3.5.10</mybatisplus.version>
+ <maven.compiler.source>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <spring-boot.version>3.4.5</spring-boot.version>
+ <spring.version>6.2.6</spring.version>
+ <iotdb-jdbc.version>2.0.4-SNAPSHOT</iotdb-jdbc.version>
+ <io-springfox.version>3.0.0</io-springfox.version>
+</properties>
+
+<dependencies>
+ <dependency>
+ <groupId>com.baomidou</groupId>
+ <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
+ <version>${mybatisplus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.baomidou</groupId>
+ <artifactId>mybatis-plus-generator</artifactId>
+ <version>${mybatisplus.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.iotdb</groupId>
+ <artifactId>iotdb-jdbc</artifactId>
+ <version>${iotdb-jdbc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <version>${spring-boot.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${io-springfox.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${io-springfox.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.36</version>
+ </dependency>
+ <dependency>
+ <groupId>com.github.jeffreyning</groupId>
+ <artifactId>mybatisplus-plus</artifactId>
+ <version>1.7.5-RELEASE</version>
+ </dependency>
+</dependencies>
+```
+
+### 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/pom.xml
b/examples/mybatisplus-generator/pom.xml
index 6c75479..859a3af 100644
--- a/examples/mybatisplus-generator/pom.xml
+++ b/examples/mybatisplus-generator/pom.xml
@@ -21,16 +21,19 @@
-->
<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.apache.iotdb</groupId>
<artifactId>iotdb-extras-parent</artifactId>
<version>2.0.4-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
+
<groupId>org.apache.iotdb</groupId>
<artifactId>mybatisplus-generator-example</artifactId>
<name>IoTDB: Example: Mybatis Plus Generator</name>
<version>2.0.4-SNAPHOT</version>
+
<properties>
<mybatisplus.version>3.5.10</mybatisplus.version>
<maven.compiler.source>17</maven.compiler.source>
@@ -38,13 +41,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>3.4.5</spring-boot.version>
<spring.version>6.2.6</spring.version>
+ <iotdb-jdbc.version>2.0.4-SNAPSHOT</iotdb-jdbc.version>
+ <io-springfox.version>3.0.0</io-springfox.version>
</properties>
+
<dependencies>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis</artifactId>
- <version>3.5.19</version>
- </dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
@@ -53,17 +54,13 @@
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
- <version>3.5.10</version>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-engine-core</artifactId>
- <version>2.4.1</version>
+ <version>${mybatisplus.version}</version>
</dependency>
+
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-jdbc</artifactId>
- <version>${iotdb.version}</version>
+ <version>${iotdb-jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -76,44 +73,55 @@
<version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>org.springdoc</groupId>
- <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
- <version>2.8.6</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <version>${spring-boot.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${io-springfox.version}</version>
</dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${io-springfox.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.36</version>
</dependency>
+ <dependency>
+ <groupId>com.github.jeffreyning</groupId>
+ <artifactId>mybatisplus-plus</artifactId>
+ <version>1.7.5-RELEASE</version>
+ </dependency>
</dependencies>
+
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <configuration>
- <ignoredDependencies>
- <!-- For some reason this plugin missed it being used
for a constant import -->
-
<ignoredDependency>org.apache.iotdb:isession</ignoredDependency>
- </ignoredDependencies>
- <usedDependencies>
- <!-- These are used at runtime in tests -->
-
<usedDependency>com.baomidou:mybatis-plus-spring-boot3-starter</usedDependency>
-
<usedDependency>org.apache.velocity:velocity-engine-core</usedDependency>
-
<usedDependency>org.springframework.boot:spring-boot-starter</usedDependency>
-
<usedDependency>org.springframework.boot:spring-boot-starter-web</usedDependency>
-
<usedDependency>org.springdoc:springdoc-openapi-starter-webmvc-ui</usedDependency>
-
<usedDependency>org.projectlombok:lombok</usedDependency>
- </usedDependencies>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
+ <groupId>org.mybatis.generator</groupId>
+ <artifactId>mybatis-generator-maven-plugin</artifactId>
+ <version>1.4.2</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.iotdb</groupId>
+ <artifactId>mybatis-generator-plugin</artifactId>
+ <version>2.0.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
<configuration>
- <skip>true</skip>
+ <verbose>true</verbose>
+ <overwrite>true</overwrite>
+
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
</configuration>
</plugin>
</plugins>
</build>
+
</project>
diff --git a/examples/mybatisplus-generator/readme.md
b/examples/mybatisplus-generator/readme.md
deleted file mode 100644
index 4ed7211..0000000
--- a/examples/mybatisplus-generator/readme.md
+++ /dev/null
@@ -1,128 +0,0 @@
-<!--
-
- 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.
-
--->
-# MybatisPlus-Generator Demo
-## Introduction
-
- This demo shows how to use IoTDB-MybatisPlus-Generator
-
-### Version usage
-
- 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)
-
-### 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);
- ```
-
-### 3. Build Dependencies with Maven in your Project
-
- ```
- <dependencies>
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
- <version>3.5.10</version>
- </dependency>
-
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-generator</artifactId>
- <version>3.5.10</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-engine-core</artifactId>
- <version>2.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.iotdb</groupId>
- <artifactId>iotdb-jdbc</artifactId>
- <version>2.0.2</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter</artifactId>
- <version>3.4.3</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <version>3.4.3</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>3.0.0</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>3.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>1.18.36</version>
- </dependency>
- </dependencies>
- ```
-
-### 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
-
- ```
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 bb98fbd..6d83687 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 class Main {
.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 class Main {
.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 class Main {
})
.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/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 0000000..be29a04
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table1Controller.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @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 0000000..2db29da
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/controller/Table2Controller.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @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 0000000..04cc32a
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table1.java
@@ -0,0 +1,76 @@
+/*
+ * 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;
+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;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @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 0000000..1f77f6e
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/entity/Table2.java
@@ -0,0 +1,76 @@
+/*
+ * 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;
+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;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @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 0000000..a5ca761
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table1Mapper.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table1Mapper extends BaseMapper<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
new file mode 100644
index 0000000..faf822b
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/mapper/Table2Mapper.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+
+/**
+ * <p>
+ * Mapper 接口
+ * </p>
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table2Mapper extends BaseMapper<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
new file mode 100644
index 0000000..cdfa50b
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table1Service.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table1Service extends IService<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
new file mode 100644
index 0000000..2ec735b
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/Table2Service.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 服务类
+ * </p>
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+public interface Table2Service extends IService<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
new file mode 100644
index 0000000..d712f15
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table1ServiceImpl.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+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;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@Service
+public class Table1ServiceImpl extends ServiceImpl<Table1Mapper, Table1>
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 0000000..b9bff35
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/service/impl/Table2ServiceImpl.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+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;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author IoTDB
+ * @since 2025-06-24
+ */
+@Service
+public class Table2ServiceImpl extends ServiceImpl<Table2Mapper, Table2>
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 0000000..7e073ed
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table1Mapper.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.iotdb.mapper.Table1Mapper">
+
+</mapper>
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 0000000..5a8a6e3
--- /dev/null
+++
b/examples/mybatisplus-generator/src/main/java/org/apache/iotdb/xml/Table2Mapper.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.iotdb.mapper.Table2Mapper">
+
+</mapper>
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 0000000..bdf355a
--- /dev/null
+++ b/examples/mybatisplus-generator/src/main/resources/application.yml
@@ -0,0 +1,23 @@
+# 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
+ 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 0000000..b368f3b
--- /dev/null
+++
b/examples/mybatisplus-generator/src/test/java/org/apache/iotdb/ApplicationTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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;
+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;
+
+@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());
+ }
+}