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 8623a5c  add default param (#77)
8623a5c is described below

commit 8623a5c44b7b415dd5e194369a716fd35cfc488c
Author: Summer <[email protected]>
AuthorDate: Wed Jun 4 15:21:23 2025 +0800

    add default param (#77)
    
    * add default param
    
    * Update readme.md
    
    ---------
    
    Co-authored-by: 2b3c511 <[email protected]>
    Co-authored-by: CritasWang <[email protected]>
---
 examples/mybatis-generator/readme.md                          | 11 +++++++++--
 .../mybatis-generator/src/main/resources/generatorConfig.xml  |  2 +-
 .../{generatorConfig.xml => generatorConfigByExample.xml}     |  4 ++--
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/examples/mybatis-generator/readme.md 
b/examples/mybatis-generator/readme.md
index 7cbdab8..3d26403 100644
--- a/examples/mybatis-generator/readme.md
+++ b/examples/mybatis-generator/readme.md
@@ -45,7 +45,7 @@ use test;
 ```
 Then we need to create a database 'table'
 ```
-CREATE TABLE mix3 (
+CREATE TABLE mix (
     time TIMESTAMP TIME,
     region STRING TAG,
     plant_id STRING TAG,
@@ -87,7 +87,13 @@ CREATE TABLE mix3 (
 
 ### 5. put The generatorConfig.xml in your project
 
-The location of the ` configurationFile ` configuration ` generatorConfig.xml 
` file can be found in the ` src/main/resources ` template of this project for 
reference` Copy its content and place it in the corresponding location
+- `src/main/resources/generatorConfig.xml`
+
+each table generates an entity object
+
+- `src/main/resources/generatorConfigByExample.xml`
+
+The generated object will contain many "by Example" methods. If you do not 
want to generate these, you can configure to cancel them in the subsequent 
table elements
 
 ### 6. exec 'mvn mybatis-generator:generate'
 
@@ -99,6 +105,7 @@ You can see the target file in your Project
 
 ```
 org/apache/iotdb/mybatis/plugin/model/Mix.java
+org/apache/iotdb/mybatis/plugin/model/MixExample.java
 org/apache/iotdb/mybatis/plugin/mapper/MixMapper.java
 org/apache/iotdb/mybatis/plugin/xml/MixMapper.xml
 ```
diff --git a/examples/mybatis-generator/src/main/resources/generatorConfig.xml 
b/examples/mybatis-generator/src/main/resources/generatorConfig.xml
index 530ff4f..db1a991 100644
--- a/examples/mybatis-generator/src/main/resources/generatorConfig.xml
+++ b/examples/mybatis-generator/src/main/resources/generatorConfig.xml
@@ -51,7 +51,7 @@
         <javaClientGenerator type="XMLMAPPER" 
targetPackage="org.apache.iotdb.mybatis.plugin.mapper" 
targetProject="src/main/java">
             <!--            <property name="enableSubPackages" 
value="true"/>-->
         </javaClientGenerator>
-        <table schema="test" tableName="mix" domainObjectName="Mix" 
enableSelectByPrimaryKey="true" enableInsert="true" 
enableDeleteByPrimaryKey="true">
+        <table schema="test" tableName="mix" domainObjectName="Mix" 
enableSelectByPrimaryKey="true" enableInsert="true" 
enableDeleteByPrimaryKey="true" enableUpdateByPrimaryKey="false">
             <property name="virtualKeyColumns" 
value="time,device_id,device_name,device_tag"/>
         </table>
     </context>
diff --git a/examples/mybatis-generator/src/main/resources/generatorConfig.xml 
b/examples/mybatis-generator/src/main/resources/generatorConfigByExample.xml
similarity index 95%
copy from examples/mybatis-generator/src/main/resources/generatorConfig.xml
copy to 
examples/mybatis-generator/src/main/resources/generatorConfigByExample.xml
index 530ff4f..63b4559 100644
--- a/examples/mybatis-generator/src/main/resources/generatorConfig.xml
+++ b/examples/mybatis-generator/src/main/resources/generatorConfigByExample.xml
@@ -20,7 +20,7 @@
 <generatorConfiguration>
     <classPathEntry 
location="/apache/iotdb/iotdb-client/jdbc/target/iotdb-jdbc-2.0.2-SNAPSHOT-jar-with-dependencies.jar"/>
     <!-- mvn mybatis-generator:generate hierarchical/flat-->
-    <context id="myBatis3Simple" targetRuntime="MyBatis3Simple" 
defaultModelType="flat">
+    <context id="mybatis3" targetRuntime="Mybatis3" defaultModelType="flat">
         <!--        <property name="suppressAllComments" value="true"/>-->
         <!--        <property name="useActualColumnNames" value="false"/>-->
         <!--        <property name="javaFormatter" 
value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>-->
@@ -51,7 +51,7 @@
         <javaClientGenerator type="XMLMAPPER" 
targetPackage="org.apache.iotdb.mybatis.plugin.mapper" 
targetProject="src/main/java">
             <!--            <property name="enableSubPackages" 
value="true"/>-->
         </javaClientGenerator>
-        <table schema="test" tableName="mix" domainObjectName="Mix" 
enableSelectByPrimaryKey="true" enableInsert="true" 
enableDeleteByPrimaryKey="true">
+        <table schema="test" tableName="mix" domainObjectName="Mix" 
enableSelectByPrimaryKey="true" enableInsert="true" 
enableDeleteByPrimaryKey="true" enableUpdateByPrimaryKey="false" 
enableSelectByExample="true">
             <property name="virtualKeyColumns" 
value="time,device_id,device_name,device_tag"/>
         </table>
     </context>

Reply via email to