ci: ui generator config

This commit is contained in:
CaptainB 2023-06-02 16:49:01 +08:00 committed by 刘瑞斌
parent d39215ac30
commit baa0eb545f
6 changed files with 101 additions and 12 deletions

View File

@ -1,7 +1,6 @@
spring.application.name=metersphere spring.application.name=metersphere
management.server.port=7071 management.server.port=7071
server.port=8081 server.port=8081
server.servlet.context-path=/backend
# gzip # gzip
server.compression.enabled=true server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css,text/javascript,image/jpeg server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css,text/javascript,image/jpeg

View File

@ -49,9 +49,11 @@
<configurationFile>src/main/resources/loadGeneratorConfig.xml</configurationFile> <configurationFile>src/main/resources/loadGeneratorConfig.xml</configurationFile>
<configurationFile>src/main/resources/sdkGeneratorConfig.xml</configurationFile> <configurationFile>src/main/resources/sdkGeneratorConfig.xml</configurationFile>
<configurationFile>src/main/resources/projectGeneratorConfig.xml</configurationFile> <configurationFile>src/main/resources/projectGeneratorConfig.xml</configurationFile>
<!-- <configurationFile>src/main/resources/systemGeneratorConfig.xml</configurationFile>--> <configurationFile>src/main/resources/systemGeneratorConfig.xml</configurationFile>
<!-- <configurationFile>src/main/resources/bugGeneratorConfig.xml</configurationFile>--> <configurationFile>src/main/resources/uiGeneratorConfig.xml</configurationFile>
<!-- <configurationFile>src/main/resources/functionalGeneratorConfig.xml</configurationFile>--> <configurationFile>src/main/resources/bugGeneratorConfig.xml</configurationFile>
<configurationFile>src/main/resources/apiGeneratorConfig.xml</configurationFile>
<configurationFile>src/main/resources/functionalGeneratorConfig.xml</configurationFile>
</configuration> </configuration>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@ -8,7 +8,7 @@ import lombok.Data;
@Data @Data
public class UiCustomCommandBlob implements Serializable { public class UiCustomCommandBlob implements Serializable {
@Schema(title = "场景ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "指令ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{ui_custom_command_blob.id.not_blank}", groups = {Updated.class}) @NotBlank(message = "{ui_custom_command_blob.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{ui_custom_command_blob.id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{ui_custom_command_blob.id.length_range}", groups = {Created.class, Updated.class})
private String id; private String id;

View File

@ -20,7 +20,7 @@ public class UiCustomCommandModule implements Serializable {
@Schema(title = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{ui_custom_command_module.name.not_blank}", groups = {Created.class}) @NotBlank(message = "{ui_custom_command_module.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 64, message = "{ui_custom_command_module.name.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 255, message = "{ui_custom_command_module.name.length_range}", groups = {Created.class, Updated.class})
private String name; private String name;
@Schema(title = "父级ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "父级ID", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -1,22 +1,20 @@
package io.metersphere.ui.domain; package io.metersphere.ui.domain;
import io.metersphere.validation.groups.Created; import io.metersphere.validation.groups.*;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.*;
import jakarta.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
@Data @Data
public class UiScenarioFollower implements Serializable { public class UiScenarioFollower implements Serializable {
@Schema(title = "场景ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "场景ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{ui_scenario_follower.scenario_id.not_blank}", groups = {Updated.class}) @NotBlank(message = "{ui_scenario_follower.scenario_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{ui_scenario_follower.scenario_id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{ui_scenario_follower.scenario_id.length_range}", groups = {Created.class, Updated.class})
private String scenarioId; private String scenarioId;
@Schema(title = "关注人ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "关注人ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{ui_scenario_follower.user_id.not_blank}", groups = {Updated.class}) @NotBlank(message = "{ui_scenario_follower.user_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{ui_scenario_follower.user_id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{ui_scenario_follower.user_id.length_range}", groups = {Created.class, Updated.class})
private String userId; private String userId;

View File

@ -0,0 +1,90 @@
<?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.ui.domain" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- XML映射文件 -->
<sqlMapGenerator targetPackage="io.metersphere.ui.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 接口 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="io.metersphere.ui.mapper"
targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!--要生成的数据库表 -->
<table tableName="ui_element"/>
<table tableName="ui_element_module"/>
<table tableName="ui_element_scenario_reference"/>
<table tableName="ui_scenario"/>
<table tableName="ui_scenario_reference"/>
<table tableName="ui_scenario_report"/>
<table tableName="ui_scenario_report_detail"/>
<table tableName="ui_scenario_report_structure"/>
<table tableName="ui_custom_command"/>
<table tableName="ui_scenario_module"/>
<table tableName="ui_custom_command_module"/>
<table tableName="ui_scenario_blob"/>
<table tableName="ui_scenario_report_environment"/>
<table tableName="ui_custom_command_blob"/>
<table tableName="ui_scenario_report_log"/>
<table tableName="ui_element_command_reference"/>
<table tableName="ui_scenario_follower"/>
</context>
</generatorConfiguration>