build: add api generator config

This commit is contained in:
fit2-zhao 2023-06-01 18:04:41 +08:00 committed by fit2-zhao
parent 762f9f3eb1
commit 582d676972
1 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
<generatorConfiguration>
<!--配置数据库连接的位置-->
<properties url="file:///opt/metersphere/conf/metersphere.properties"/>
<!-- 设置mysql驱动路径 -->
<!--<classPathEntry location="/Users/liuruibin/.m2/repository/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar"/>-->
<!-- 此处指定生成针对MyBatis3的DAO -->
<context id="mysql" targetRuntime="MyBatis3" defaultModelType="flat">
<!-- 字段带`,解决列表跟关键字冲突问题 -->
<property name="autoDelimitKeywords" value="true"/>
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin"/>
<plugin type="io.metersphere.tools.mybatis.swagger.ImportSwagger3Plugin"/>
<plugin type="io.metersphere.tools.mybatis.validation.ImportValidatorPlugin"/>
<!-- Lombok插件 -->
<plugin type="com.itfsw.mybatis.generator.plugins.LombokPlugin">
<!-- @Data 默认开启,同时插件会对子类自动附加@EqualsAndHashCode(callSuper = true)@ToString(callSuper = true) -->
<property name="@Data" value="true"/>
<!-- @Builder 必须在 Lombok 版本 >= 1.18.2 的情况下开启,对存在继承关系的类自动替换成@SuperBuilder -->
<property name="@Builder" value="false"/>
<!-- @NoArgsConstructor 和 @AllArgsConstructor 使用规则和Lombok一致 -->
<property name="@AllArgsConstructor" value="false"/>
<property name="@NoArgsConstructor" value="false"/>
<!-- @Getter、@Setter、@Accessors 等使用规则参见官方文档 -->
<property name="@Accessors(chain = true)" value="false"/>
<!-- 临时解决IDEA工具对@SuperBuilder的不支持问题开启后(默认未开启)插件在遇到@SuperBuilder注解时会调用ModelBuilderPlugin来生成相应的builder代码 -->
<property name="supportSuperBuilderForIdea" value="false"/>
</plugin>
<!-- 用来除去时间信息的这在配合类似subversion的代码管理工具时使用很有效因为可以减少没有必要的注释迁入 -->
<commentGenerator type="io.metersphere.tools.mybatis.validation.SchemaAnnotationGenerator">
<property name="suppressDate" value="true"/>
<!-- 关闭自动生成的注释 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- jdbc连接信息 --> <!-- EduLoanManage EduTestDataBase -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="${spring.datasource.url}&amp;nullCatalogMeansCurrent=true"
userId="${spring.datasource.username}"
password="${spring.datasource.password}"/>
<!-- javaTypeResolver式类型转换的信息 -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 模型对象 -->
<javaModelGenerator targetPackage="io.metersphere.api.domain" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- XML映射文件 -->
<sqlMapGenerator targetPackage="io.metersphere.api.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 接口 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="io.metersphere.api.mapper"
targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!--要生成的数据库表 -->
<table tableName="api_definition"/>
<table tableName="api_definition_blob"/>
<table tableName="api_definition_module"/>
<table tableName="api_environment_config"/>
<table tableName="api_definition_mock"/>
<table tableName="api_definition_mock_config"/>
<table tableName="api_definition_swagger"/>
<table tableName="api_report"/>
<table tableName="api_report_blob"/>
<table tableName="api_definition_follower"/>
<table tableName="api_test_case"/>
<table tableName="api_test_case_blob"/>
<table tableName="api_test_case_follower"/>
<table tableName="api_scenario"/>
<table tableName="api_scenario_environment"/>
<table tableName="api_scenario_blob"/>
<table tableName="api_scenario_follower"/>
<table tableName="api_scenario_module"/>
<table tableName="api_scenario_reference"/>
<table tableName="api_scenario_report"/>
<table tableName="api_scenario_report_detail"/>
<table tableName="api_scenario_report_structure"/>
<table tableName="api_scenario_report_log"/>
<table tableName="api_sync_config"/>
</context>
</generatorConfiguration>