This is an automated email from the ASF dual-hosted git repository.

zhaoxinyi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git


The following commit(s) were added to refs/heads/main by this push:
     new f1a77deb add mybatisPlus to table ecosystem (#816)
f1a77deb is described below

commit f1a77debfc8175f40b6d2b72b3d2f3701a7eecff
Author: W1y1r <[email protected]>
AuthorDate: Fri Jul 4 23:34:41 2025 +0800

    add mybatisPlus to table ecosystem (#816)
    
    * add mybatisPlus to table ecosystem
    
    * add mybatisPlus to table ecosystem
---
 src/.vuepress/public/img/MyBatisPlus-Generator.png | Bin 0 -> 93682 bytes
 src/.vuepress/sidebar/V2.0.x/en-Table.ts           |   9 +
 src/.vuepress/sidebar/V2.0.x/zh-Table.ts           |   9 +
 src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts   |   9 +
 src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts   |   9 +
 .../Ecosystem-Integration/MyBatisPlus-Generator.md | 318 +++++++++++++++++++++
 .../Ecosystem-Integration/MyBatisPlus-Generator.md | 318 +++++++++++++++++++++
 .../Ecosystem-Integration/MyBatisPlus-Generator.md | 318 +++++++++++++++++++++
 .../Ecosystem-Integration/MyBatisPlus-Generator.md | 318 +++++++++++++++++++++
 9 files changed, 1308 insertions(+)

diff --git a/src/.vuepress/public/img/MyBatisPlus-Generator.png 
b/src/.vuepress/public/img/MyBatisPlus-Generator.png
new file mode 100644
index 00000000..612b5705
Binary files /dev/null and b/src/.vuepress/public/img/MyBatisPlus-Generator.png 
differ
diff --git a/src/.vuepress/sidebar/V2.0.x/en-Table.ts 
b/src/.vuepress/sidebar/V2.0.x/en-Table.ts
index 196c6529..acedc566 100644
--- a/src/.vuepress/sidebar/V2.0.x/en-Table.ts
+++ b/src/.vuepress/sidebar/V2.0.x/en-Table.ts
@@ -169,6 +169,15 @@ export const enSidebar = {
             { text: 'DataGrip', link: 'DataGrip' },
           ],
         },
+        {
+          text: 'Programming Framework',
+          collapsible: true,
+          children: [
+            { text: 'Spring Boot Starter', link: 'Spring-Boot-Starter' },
+            { text: 'Mybatis Generator', link: 'Mybatis-Generator' },
+            { text: 'MyBatisPlus Generator', link: 'MyBatisPlus-Generator' },
+          ],
+        },
       ],
     },
     {
diff --git a/src/.vuepress/sidebar/V2.0.x/zh-Table.ts 
b/src/.vuepress/sidebar/V2.0.x/zh-Table.ts
index e0d320ef..54e66182 100644
--- a/src/.vuepress/sidebar/V2.0.x/zh-Table.ts
+++ b/src/.vuepress/sidebar/V2.0.x/zh-Table.ts
@@ -159,6 +159,15 @@ export const zhSidebar = {
             { text: 'DataGrip', link: 'DataGrip' },
           ],
         },
+        {
+          text: '编程框架',
+          collapsible: true,
+          children: [
+            { text: 'Spring Boot Starter', link: 'Spring-Boot-Starter' },
+            { text: 'Mybatis Generator', link: 'Mybatis-Generator' },
+            { text: 'MyBatisPlus Generator', link: 'MyBatisPlus-Generator' },
+          ],
+        },
       ],
     },
     {
diff --git a/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts 
b/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts
index d7595f13..caa42c97 100644
--- a/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts
+++ b/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts
@@ -174,6 +174,15 @@ export const enSidebar = {
             { text: 'DataGrip', link: 'DataGrip' },
           ],
         },
+        {
+          text: 'Programming Framework',
+          collapsible: true,
+          children: [
+            { text: 'Spring Boot Starter', link: 'Spring-Boot-Starter' },
+            { text: 'Mybatis Generator', link: 'Mybatis-Generator' },
+            { text: 'MyBatisPlus Generator', link: 'MyBatisPlus-Generator' },
+          ],
+        },
       ],
     },
     {
diff --git a/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts 
b/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts
index a3dae6bc..c3cc0a07 100644
--- a/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts
+++ b/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts
@@ -163,6 +163,15 @@ export const zhSidebar = {
                { text: 'DataGrip', link: 'DataGrip' },
              ],
            },
+           {
+              text: '编程框架',
+              collapsible: true,
+              children: [
+                { text: 'Spring Boot Starter', link: 'Spring-Boot-Starter' },
+                { text: 'Mybatis Generator', link: 'Mybatis-Generator' },
+                { text: 'MyBatisPlus Generator', link: 'MyBatisPlus-Generator' 
},
+              ],
+           },
          ],
        },
     {
diff --git 
a/src/UserGuide/Master/Table/Ecosystem-Integration/MyBatisPlus-Generator.md 
b/src/UserGuide/Master/Table/Ecosystem-Integration/MyBatisPlus-Generator.md
new file mode 100644
index 00000000..58968106
--- /dev/null
+++ b/src/UserGuide/Master/Table/Ecosystem-Integration/MyBatisPlus-Generator.md
@@ -0,0 +1,318 @@
+<!--
+    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
+
+## 1. Overview
+
+MyBatis-Plus Generator is a built-in code generation tool of the MyBatis-Plus 
framework. It automatically generates standardized entity classes, Mapper 
interfaces, Service layers, and Controller layer code based on the database 
table structure. It integrates MyBatis-Plus's general CRUD methods (such as 
`BaseMapper` built-in create, read, update, delete) and condition constructors 
(`QueryWrapper`), and supports extended annotations like Lombok and Swagger. 
Through simple configuration, it [...]
+
+The following will introduce how to use Mybatis-Plus Generator to connect to 
IoTDB and generate entity classes, Mapper interfaces, Service layers, and 
Controller layer code files corresponding to database tables.
+
+## 2. Usage Steps
+
+### 2.1 Version Requirements
+
+- IoTDB: >=2.0.2-SNAPSHOT
+- mybatisPlus: >=3.5.10
+- iotdb-jdbc:>=2.0.4-SNAPSHOT
+
+### 2.2 Operating Process
+
+#### 2.2.1 IoTDB Environment Setup
+
+1. Download, install, and start the IoTDB service. For details, refer to 
[QuickStart](../QuickStart/QuickStart.md)
+2. Create the database database1 and tables table1 / table2. Relevant SQL 
statements can refer to [Sample-Data](../Reference/Sample-Data.md)
+
+#### 2.2.2 Create a Maven Project
+
+1. Create a Maven project
+2. Add the following dependency configurations to the pom
+
+```XML
+<properties>
+    <maven.compiler.source>17</maven.compiler.source>
+    <maven.compiler.target>17</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+</properties>
+
+<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>com.github.jeffreyning</groupId>
+        <artifactId>mybatisplus-plus</artifactId>
+        <version>1.7.5-RELEASE</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.4-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-web</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </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>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-test</artifactId>
+        <version>3.4.3</version>
+        <scope>test</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>2.0.13</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-classic</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-core</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+</dependencies>
+<build>
+    <plugins>
+        <plugin>
+            <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>
+                <verbose>true</verbose>
+                <overwrite>true</overwrite>
+                
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
+            </configuration>
+        </plugin>
+    </plugins>
+</build>
+```
+3. Create an execution file, modify the `url`/`username`/`password` of the 
target IoTDB, and the target file generation directory `outputDir`/`pathInfo`
+
+```Java
+package org.apache.iotdb;
+
+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/database1?sql_dialect=table");
+        dataSource.setUser("root");
+        dataSource.setPassword("root");
+        FastAutoGenerator generator = FastAutoGenerator.create(new 
DataSourceConfig.Builder(dataSource).driverClassName("org.apache.iotdb.jdbc.IoTDBDriver"));
+        generator
+                .globalConfig(builder -> {
+                    builder.author("IoTDB")
+                            .enableSwagger()
+                            .dateType(DateType.ONLY_DATE)
+                            .outputDir("src/main/java");
+                })
+                .packageConfig(builder -> {
+                    builder.parent("org.apache.iotdb")
+                            .mapper("mapper")
+                            .pathInfo(Collections.singletonMap(OutputFile.xml, 
"src/main/java/org/apache/iotdb/xml"));
+                })
+                .dataSourceConfig(builder -> {
+                    builder.typeConvertHandler((globalConfig, typeRegistry, 
metaInfo) -> {
+                        int typeCode = metaInfo.getJdbcType().TYPE_CODE;
+                        switch (typeCode) {
+                            case Types.FLOAT:
+                                return DbColumnType.FLOAT;
+                            default:
+                                return typeRegistry.getColumnType(metaInfo);
+                        }
+                    });
+                })
+                .strategyConfig(builder -> {
+                    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")
+                            .enableFileOverride();
+                    builder.serviceBuilder()
+                            .formatServiceFileName("%sService")
+                            .formatServiceImplFileName("%sServiceImpl")
+                            .convertServiceFileName((entityName -> entityName 
+ "Service"))
+                            .enableFileOverride();
+                    builder.controllerBuilder()
+                            .enableRestStyle()
+                            .enableFileOverride();
+                })
+                .execute();
+    }
+}
+```
+
+#### 2.2.3 Generate Target Files
+
+1. Run Main.java
+2. View the log output. The following indicates that the target files are 
generated
+
+```Java
+16:10:08.943 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator -- 
==========================File generation completed!!!==========================
+```
+
+#### 2.2.4 Generate Target Files
+
+```Plain
+org/apache/iotdb/controller/Table1Controller.java
+org/apache/iotdb/controller/Table2Controller.java
+org/apache/iotdb/entity/Table1.java
+org/apache/iotdb/mapper/Table2.xml
+org/apache/iotdb/service/Table1Service.java  
+org/apache/iotdb/service/Table2Service.java
+org/apache/iotdb/service/impl/Table1ServiceImpl.java  
+org/apache/iotdb/service/impl/Table2ServiceImpl.java
+org/apache/iotdb/xml/Table1Mapper.xml
+org/apache/iotdb/xml/Table2Mapper.xml
+```
+![](/img/MyBatisPlus-Generator.png)
+
+#### 2.2.5 Modify Annotations
+
+Manually adjust the generated code `org/apache/iotdb/entity/Table1.java`, 
`org/apache/iotdb/entity/Table2.java` to support multi-primary key queries.
+
+```TypeScript
+// Add new import
+import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("time")
+private Date time;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("region")
+private String region;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("plant_id")
+private String plantId;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("device_id")
+private String deviceId;
+```
+
+## 3. Usage Example
+
+For a complete usage example, refer to the source code 
[examples/mybatisplus-generator](https://github.com/apache/iotdb-extras/tree/master/examples/mybatisplus-generator)
 
+
diff --git 
a/src/UserGuide/latest-Table/Ecosystem-Integration/MyBatisPlus-Generator.md 
b/src/UserGuide/latest-Table/Ecosystem-Integration/MyBatisPlus-Generator.md
new file mode 100644
index 00000000..58968106
--- /dev/null
+++ b/src/UserGuide/latest-Table/Ecosystem-Integration/MyBatisPlus-Generator.md
@@ -0,0 +1,318 @@
+<!--
+    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
+
+## 1. Overview
+
+MyBatis-Plus Generator is a built-in code generation tool of the MyBatis-Plus 
framework. It automatically generates standardized entity classes, Mapper 
interfaces, Service layers, and Controller layer code based on the database 
table structure. It integrates MyBatis-Plus's general CRUD methods (such as 
`BaseMapper` built-in create, read, update, delete) and condition constructors 
(`QueryWrapper`), and supports extended annotations like Lombok and Swagger. 
Through simple configuration, it [...]
+
+The following will introduce how to use Mybatis-Plus Generator to connect to 
IoTDB and generate entity classes, Mapper interfaces, Service layers, and 
Controller layer code files corresponding to database tables.
+
+## 2. Usage Steps
+
+### 2.1 Version Requirements
+
+- IoTDB: >=2.0.2-SNAPSHOT
+- mybatisPlus: >=3.5.10
+- iotdb-jdbc:>=2.0.4-SNAPSHOT
+
+### 2.2 Operating Process
+
+#### 2.2.1 IoTDB Environment Setup
+
+1. Download, install, and start the IoTDB service. For details, refer to 
[QuickStart](../QuickStart/QuickStart.md)
+2. Create the database database1 and tables table1 / table2. Relevant SQL 
statements can refer to [Sample-Data](../Reference/Sample-Data.md)
+
+#### 2.2.2 Create a Maven Project
+
+1. Create a Maven project
+2. Add the following dependency configurations to the pom
+
+```XML
+<properties>
+    <maven.compiler.source>17</maven.compiler.source>
+    <maven.compiler.target>17</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+</properties>
+
+<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>com.github.jeffreyning</groupId>
+        <artifactId>mybatisplus-plus</artifactId>
+        <version>1.7.5-RELEASE</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.4-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-web</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </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>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-test</artifactId>
+        <version>3.4.3</version>
+        <scope>test</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>2.0.13</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-classic</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-core</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+</dependencies>
+<build>
+    <plugins>
+        <plugin>
+            <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>
+                <verbose>true</verbose>
+                <overwrite>true</overwrite>
+                
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
+            </configuration>
+        </plugin>
+    </plugins>
+</build>
+```
+3. Create an execution file, modify the `url`/`username`/`password` of the 
target IoTDB, and the target file generation directory `outputDir`/`pathInfo`
+
+```Java
+package org.apache.iotdb;
+
+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/database1?sql_dialect=table");
+        dataSource.setUser("root");
+        dataSource.setPassword("root");
+        FastAutoGenerator generator = FastAutoGenerator.create(new 
DataSourceConfig.Builder(dataSource).driverClassName("org.apache.iotdb.jdbc.IoTDBDriver"));
+        generator
+                .globalConfig(builder -> {
+                    builder.author("IoTDB")
+                            .enableSwagger()
+                            .dateType(DateType.ONLY_DATE)
+                            .outputDir("src/main/java");
+                })
+                .packageConfig(builder -> {
+                    builder.parent("org.apache.iotdb")
+                            .mapper("mapper")
+                            .pathInfo(Collections.singletonMap(OutputFile.xml, 
"src/main/java/org/apache/iotdb/xml"));
+                })
+                .dataSourceConfig(builder -> {
+                    builder.typeConvertHandler((globalConfig, typeRegistry, 
metaInfo) -> {
+                        int typeCode = metaInfo.getJdbcType().TYPE_CODE;
+                        switch (typeCode) {
+                            case Types.FLOAT:
+                                return DbColumnType.FLOAT;
+                            default:
+                                return typeRegistry.getColumnType(metaInfo);
+                        }
+                    });
+                })
+                .strategyConfig(builder -> {
+                    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")
+                            .enableFileOverride();
+                    builder.serviceBuilder()
+                            .formatServiceFileName("%sService")
+                            .formatServiceImplFileName("%sServiceImpl")
+                            .convertServiceFileName((entityName -> entityName 
+ "Service"))
+                            .enableFileOverride();
+                    builder.controllerBuilder()
+                            .enableRestStyle()
+                            .enableFileOverride();
+                })
+                .execute();
+    }
+}
+```
+
+#### 2.2.3 Generate Target Files
+
+1. Run Main.java
+2. View the log output. The following indicates that the target files are 
generated
+
+```Java
+16:10:08.943 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator -- 
==========================File generation completed!!!==========================
+```
+
+#### 2.2.4 Generate Target Files
+
+```Plain
+org/apache/iotdb/controller/Table1Controller.java
+org/apache/iotdb/controller/Table2Controller.java
+org/apache/iotdb/entity/Table1.java
+org/apache/iotdb/mapper/Table2.xml
+org/apache/iotdb/service/Table1Service.java  
+org/apache/iotdb/service/Table2Service.java
+org/apache/iotdb/service/impl/Table1ServiceImpl.java  
+org/apache/iotdb/service/impl/Table2ServiceImpl.java
+org/apache/iotdb/xml/Table1Mapper.xml
+org/apache/iotdb/xml/Table2Mapper.xml
+```
+![](/img/MyBatisPlus-Generator.png)
+
+#### 2.2.5 Modify Annotations
+
+Manually adjust the generated code `org/apache/iotdb/entity/Table1.java`, 
`org/apache/iotdb/entity/Table2.java` to support multi-primary key queries.
+
+```TypeScript
+// Add new import
+import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("time")
+private Date time;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("region")
+private String region;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("plant_id")
+private String plantId;
+
+// Add new annotation @MppMultiId
+@MppMultiId
+// Modify annotation @TableId() -->> @TableField()
+@TableField("device_id")
+private String deviceId;
+```
+
+## 3. Usage Example
+
+For a complete usage example, refer to the source code 
[examples/mybatisplus-generator](https://github.com/apache/iotdb-extras/tree/master/examples/mybatisplus-generator)
 
+
diff --git 
a/src/zh/UserGuide/Master/Table/Ecosystem-Integration/MyBatisPlus-Generator.md 
b/src/zh/UserGuide/Master/Table/Ecosystem-Integration/MyBatisPlus-Generator.md
new file mode 100644
index 00000000..a80ea430
--- /dev/null
+++ 
b/src/zh/UserGuide/Master/Table/Ecosystem-Integration/MyBatisPlus-Generator.md
@@ -0,0 +1,318 @@
+<!--
+    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
+
+## 1. 概述
+
+MyBatis-Plus Generator 是 MyBatis-Plus 框架内置的代码生成工具,基于数据库表结构自动生成标准化的实体类、Mapper 
接口、Service 层及 Controller 层代码,集成 MyBatis-Plus 的通用 CRUD 方法(如 `BaseMapper` 
内置增删改查)和条件构造器(`QueryWrapper`),支持 Lombok、Swagger 
等扩展注解,通过简单配置即可快速构建符合企业级规范的持久层代码,大幅减少单表操作的重复开发工作,适用于快速搭建后台管理系统或标准化数据服务模块。
+
+下文将介绍如何使用 Mybatis-Plus Generator 连接 IoTDB ,并生成数据库表对应的实体类、Mapper 接口、Service 层及 
Controller 层代码文件。
+
+## 2. 使用步骤
+
+### 2.1 版本要求
+
+- IoTDB: >=2.0.2-SNAPSHOT
+- mybatisPlus: >=3.5.10
+- iotdb-jdbc:>=2.0.4-SNAPSHOT
+
+### 2.2 操作流程
+
+#### 2.2.1 IoTDB 环境搭建
+
+1. 下载、安装并启动 IoTDB 服务,具体可参考[快速上手](../QuickStart/QuickStart.md)
+2. 创建数据库 database1 及表 table1 / table2,相关 SQL 
语句可参考[示例数据](../Reference/Sample-Data.md)
+
+#### 2.2.2 创建 Maven项目
+
+1. 创建 Maven 项目
+2. 在 pom 中增加如下依赖配置
+
+```XML
+<properties>
+    <maven.compiler.source>17</maven.compiler.source>
+    <maven.compiler.target>17</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+</properties>
+
+<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>com.github.jeffreyning</groupId>
+        <artifactId>mybatisplus-plus</artifactId>
+        <version>1.7.5-RELEASE</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.4-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-web</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </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>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-test</artifactId>
+        <version>3.4.3</version>
+        <scope>test</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>2.0.13</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-classic</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-core</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+</dependencies>
+<build>
+    <plugins>
+        <plugin>
+            <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>
+                <verbose>true</verbose>
+                <overwrite>true</overwrite>
+                
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
+            </configuration>
+        </plugin>
+    </plugins>
+</build>
+```
+3. 新建执行文件,修改目标 IoTDB 的 `url`/ `username` / `password`,和目标文件生成目录 
`outputDir`/`pathInfo`
+
+```Java
+package org.apache.iotdb;
+
+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/database1?sql_dialect=table");
+        dataSource.setUser("root");
+        dataSource.setPassword("root");
+        FastAutoGenerator generator = FastAutoGenerator.create(new 
DataSourceConfig.Builder(dataSource).driverClassName("org.apache.iotdb.jdbc.IoTDBDriver"));
+        generator
+                .globalConfig(builder -> {
+                    builder.author("IoTDB")
+                            .enableSwagger()
+                            .dateType(DateType.ONLY_DATE)
+                            .outputDir("src/main/java");
+                })
+                .packageConfig(builder -> {
+                    builder.parent("org.apache.iotdb")
+                            .mapper("mapper")
+                            .pathInfo(Collections.singletonMap(OutputFile.xml, 
"src/main/java/org/apache/iotdb/xml"));
+                })
+                .dataSourceConfig(builder -> {
+                    builder.typeConvertHandler((globalConfig, typeRegistry, 
metaInfo) -> {
+                        int typeCode = metaInfo.getJdbcType().TYPE_CODE;
+                        switch (typeCode) {
+                            case Types.FLOAT:
+                                return DbColumnType.FLOAT;
+                            default:
+                                return typeRegistry.getColumnType(metaInfo);
+                        }
+                    });
+                })
+                .strategyConfig(builder -> {
+                    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")
+                            .enableFileOverride();
+                    builder.serviceBuilder()
+                            .formatServiceFileName("%sService")
+                            .formatServiceImplFileName("%sServiceImpl")
+                            .convertServiceFileName((entityName -> entityName 
+ "Service"))
+                            .enableFileOverride();
+                    builder.controllerBuilder()
+                            .enableRestStyle()
+                            .enableFileOverride();
+                })
+                .execute();
+    }
+}
+```
+
+#### 2.2.3 生成目标文件
+
+1. 运行 Main.java
+2. 查看日志输出,如下所示即生成目标文件
+
+```Java
+16:10:08.943 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator -- 
==========================文件生成完成!!!==========================
+```
+
+#### 2.2.4 查看目标文件
+
+```Plain
+org/apache/iotdb/controller/Table1Controller.java
+org/apache/iotdb/controller/Table2Controller.java
+org/apache/iotdb/entity/Table1.java
+org/apache/iotdb/mapper/Table2.xml
+org/apache/iotdb/service/Table1Service.java  
+org/apache/iotdb/service/Table2Service.java
+org/apache/iotdb/service/impl/Table1ServiceImpl.java  
+org/apache/iotdb/service/impl/Table2ServiceImpl.java
+org/apache/iotdb/xml/Table1Mapper.xml
+org/apache/iotdb/xml/Table2Mapper.xml
+```
+![](/img/MyBatisPlus-Generator.png)
+
+#### 2.2.5 修改注释
+
+手动调整生成的代码`org/apache/iotdb/entity/Table1.java`,`org/apache/iotdb/entity/Table2.java`使其支持多主键查询。
+
+```TypeScript
+// 新增 import
+import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("time")
+private Date time;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("region")
+private String region;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("plant_id")
+private String plantId;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("device_id")
+private String deviceId;
+```
+
+## 3. 使用示例
+
+完整的使用示例可参考源码 
[examples/mybatisplus-generator](https://github.com/apache/iotdb-extras/tree/master/examples/mybatisplus-generator)
 
+
diff --git 
a/src/zh/UserGuide/latest-Table/Ecosystem-Integration/MyBatisPlus-Generator.md 
b/src/zh/UserGuide/latest-Table/Ecosystem-Integration/MyBatisPlus-Generator.md
new file mode 100644
index 00000000..a80ea430
--- /dev/null
+++ 
b/src/zh/UserGuide/latest-Table/Ecosystem-Integration/MyBatisPlus-Generator.md
@@ -0,0 +1,318 @@
+<!--
+    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
+
+## 1. 概述
+
+MyBatis-Plus Generator 是 MyBatis-Plus 框架内置的代码生成工具,基于数据库表结构自动生成标准化的实体类、Mapper 
接口、Service 层及 Controller 层代码,集成 MyBatis-Plus 的通用 CRUD 方法(如 `BaseMapper` 
内置增删改查)和条件构造器(`QueryWrapper`),支持 Lombok、Swagger 
等扩展注解,通过简单配置即可快速构建符合企业级规范的持久层代码,大幅减少单表操作的重复开发工作,适用于快速搭建后台管理系统或标准化数据服务模块。
+
+下文将介绍如何使用 Mybatis-Plus Generator 连接 IoTDB ,并生成数据库表对应的实体类、Mapper 接口、Service 层及 
Controller 层代码文件。
+
+## 2. 使用步骤
+
+### 2.1 版本要求
+
+- IoTDB: >=2.0.2-SNAPSHOT
+- mybatisPlus: >=3.5.10
+- iotdb-jdbc:>=2.0.4-SNAPSHOT
+
+### 2.2 操作流程
+
+#### 2.2.1 IoTDB 环境搭建
+
+1. 下载、安装并启动 IoTDB 服务,具体可参考[快速上手](../QuickStart/QuickStart.md)
+2. 创建数据库 database1 及表 table1 / table2,相关 SQL 
语句可参考[示例数据](../Reference/Sample-Data.md)
+
+#### 2.2.2 创建 Maven项目
+
+1. 创建 Maven 项目
+2. 在 pom 中增加如下依赖配置
+
+```XML
+<properties>
+    <maven.compiler.source>17</maven.compiler.source>
+    <maven.compiler.target>17</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+</properties>
+
+<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>com.github.jeffreyning</groupId>
+        <artifactId>mybatisplus-plus</artifactId>
+        <version>1.7.5-RELEASE</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.4-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-web</artifactId>
+        <version>3.4.3</version>
+        <exclusions>
+            <exclusion>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+            </exclusion>
+            <exclusion>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+            </exclusion>
+        </exclusions>
+    </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>
+    <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-test</artifactId>
+        <version>3.4.3</version>
+        <scope>test</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>2.0.13</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-classic</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+    <dependency>
+        <groupId>ch.qos.logback</groupId>
+        <artifactId>logback-core</artifactId>
+        <version>1.5.16</version>
+    </dependency>
+</dependencies>
+<build>
+    <plugins>
+        <plugin>
+            <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>
+                <verbose>true</verbose>
+                <overwrite>true</overwrite>
+                
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
+            </configuration>
+        </plugin>
+    </plugins>
+</build>
+```
+3. 新建执行文件,修改目标 IoTDB 的 `url`/ `username` / `password`,和目标文件生成目录 
`outputDir`/`pathInfo`
+
+```Java
+package org.apache.iotdb;
+
+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/database1?sql_dialect=table");
+        dataSource.setUser("root");
+        dataSource.setPassword("root");
+        FastAutoGenerator generator = FastAutoGenerator.create(new 
DataSourceConfig.Builder(dataSource).driverClassName("org.apache.iotdb.jdbc.IoTDBDriver"));
+        generator
+                .globalConfig(builder -> {
+                    builder.author("IoTDB")
+                            .enableSwagger()
+                            .dateType(DateType.ONLY_DATE)
+                            .outputDir("src/main/java");
+                })
+                .packageConfig(builder -> {
+                    builder.parent("org.apache.iotdb")
+                            .mapper("mapper")
+                            .pathInfo(Collections.singletonMap(OutputFile.xml, 
"src/main/java/org/apache/iotdb/xml"));
+                })
+                .dataSourceConfig(builder -> {
+                    builder.typeConvertHandler((globalConfig, typeRegistry, 
metaInfo) -> {
+                        int typeCode = metaInfo.getJdbcType().TYPE_CODE;
+                        switch (typeCode) {
+                            case Types.FLOAT:
+                                return DbColumnType.FLOAT;
+                            default:
+                                return typeRegistry.getColumnType(metaInfo);
+                        }
+                    });
+                })
+                .strategyConfig(builder -> {
+                    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")
+                            .enableFileOverride();
+                    builder.serviceBuilder()
+                            .formatServiceFileName("%sService")
+                            .formatServiceImplFileName("%sServiceImpl")
+                            .convertServiceFileName((entityName -> entityName 
+ "Service"))
+                            .enableFileOverride();
+                    builder.controllerBuilder()
+                            .enableRestStyle()
+                            .enableFileOverride();
+                })
+                .execute();
+    }
+}
+```
+
+#### 2.2.3 生成目标文件
+
+1. 运行 Main.java
+2. 查看日志输出,如下所示即生成目标文件
+
+```Java
+16:10:08.943 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator -- 
==========================文件生成完成!!!==========================
+```
+
+#### 2.2.4 查看目标文件
+
+```Plain
+org/apache/iotdb/controller/Table1Controller.java
+org/apache/iotdb/controller/Table2Controller.java
+org/apache/iotdb/entity/Table1.java
+org/apache/iotdb/mapper/Table2.xml
+org/apache/iotdb/service/Table1Service.java  
+org/apache/iotdb/service/Table2Service.java
+org/apache/iotdb/service/impl/Table1ServiceImpl.java  
+org/apache/iotdb/service/impl/Table2ServiceImpl.java
+org/apache/iotdb/xml/Table1Mapper.xml
+org/apache/iotdb/xml/Table2Mapper.xml
+```
+![](/img/MyBatisPlus-Generator.png)
+
+#### 2.2.5 修改注释
+
+手动调整生成的代码`org/apache/iotdb/entity/Table1.java`,`org/apache/iotdb/entity/Table2.java`使其支持多主键查询。
+
+```TypeScript
+// 新增 import
+import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("time")
+private Date time;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("region")
+private String region;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("plant_id")
+private String plantId;
+
+//  新增注解 @MppMultiId
+@MppMultiId
+// 修改注解 @TableId() -->> @TableField()
+@TableField("device_id")
+private String deviceId;
+```
+
+## 3. 使用示例
+
+完整的使用示例可参考源码 
[examples/mybatisplus-generator](https://github.com/apache/iotdb-extras/tree/master/examples/mybatisplus-generator)
 
+

Reply via email to