From c90772bb055970f4fa267ce1e2466d485eb65687 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Mon, 25 Sep 2023 18:16:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=8E=E5=AD=97=E6=AE=B5=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --task=1012795 --user=陈建星 项目管理-模版管理-后台 https://www.tapd.cn/55049933/s/1420871 --- .../system/domain/CustomField.java | 9 + .../system/domain/CustomFieldExample.java | 130 ++++++ .../system/domain/OrganizationParameter.java | 100 +++++ .../domain/OrganizationParameterExample.java | 410 ++++++++++++++++++ .../metersphere/system/domain/Template.java | 9 + .../system/domain/TemplateExample.java | 130 ++++++ .../system/mapper/CustomFieldMapper.xml | 49 ++- .../mapper/OrganizationParameterMapper.java | 34 ++ .../mapper/OrganizationParameterMapper.xml | 213 +++++++++ .../system/mapper/TemplateMapper.xml | 49 ++- .../3.0.0/ddl/V3.0.0_11__system_setting.sql | 26 +- .../migration/3.0.0/dml/V3.0.0_11_1__data.sql | 72 ++- .../DefaultFunctionalCustomField.java | 52 +++ .../OrganizationParameterConstants.java | 8 + .../sdk/constants/PermissionConstants.java | 17 +- .../sdk/constants/TemplateScene.java | 3 +- .../dto/request/CustomFieldUpdateRequest.java | 4 +- .../dto/request/TemplateUpdateRequest.java | 5 +- .../io/metersphere/sdk/util/SubListUtil.java | 26 ++ .../main/resources/i18n/commons.properties | 7 +- .../resources/i18n/commons_en_US.properties | 3 + .../resources/i18n/commons_zh_CN.properties | 3 + .../resources/i18n/commons_zh_TW.properties | 3 + .../main/resources/i18n/project.properties | 8 +- .../resources/i18n/project_en_US.properties | 5 +- .../resources/i18n/project_zh_CN.properties | 4 +- .../resources/i18n/project_zh_TW.properties | 7 +- .../src/main/resources/i18n/system.properties | 2 + .../resources/i18n/system_en_US.properties | 2 + .../resources/i18n/system_zh_CN.properties | 2 + .../resources/i18n/system_zh_TW.properties | 2 + .../ProjectCustomFieldController.java | 82 ++++ .../controller/ProjectTemplateController.java | 90 ++++ .../enums/result/ProjectResultCode.java | 6 +- .../service/ProjectCustomFieldLogService.java | 64 +++ .../service/ProjectCustomFieldService.java | 73 ++++ .../project/service/ProjectService.java | 6 + .../service/ProjectTemplateLogService.java | 85 ++++ .../service/ProjectTemplateService.java | 90 ++++ .../ProjectCustomFieldControllerTests.java | 292 +++++++++++++ .../ProjectTemplateControllerTests.java | 372 ++++++++++++++++ .../OrganizationTemplateController.java | 21 +- .../handler/result/CommonResultCode.java | 13 +- .../controller/result/SystemResultCode.java | 4 + .../log/constants/OperationLogModule.java | 5 +- .../system/mapper/BaseProjectMapper.java | 3 + .../system/mapper/BaseProjectMapper.xml | 5 + .../ExtOrganizationCustomFieldMapper.java | 12 + .../ExtOrganizationCustomFieldMapper.xml | 7 + .../mapper/ExtOrganizationTemplateMapper.java | 12 + .../mapper/ExtOrganizationTemplateMapper.xml | 7 + .../service/BaseCustomFieldOptionService.java | 35 +- .../service/BaseCustomFieldService.java | 116 ++++- .../BaseOrganizationParameterService.java | 43 ++ .../BaseTemplateCustomFieldService.java | 19 + .../system/service/BaseTemplateService.java | 170 +++++++- .../CleanupTemplateResourceService.java | 20 + .../CreateTemplateResourceService.java | 155 +++++++ .../OrganizationCustomFieldService.java | 113 ++++- .../system/service/OrganizationService.java | 19 +- .../OrganizationTemplateLogService.java | 18 + .../service/OrganizationTemplateService.java | 160 ++++++- .../src/main/resources/permission.json | 4 + .../main/resources/systemGeneratorConfig.xml | 1 + ...rganizationCustomFieldControllerTests.java | 86 +++- .../OrganizationTemplateControllerTests.java | 161 ++++++- .../SystemProjectControllerTests.java | 181 ++++++-- .../CustomFieldUpdateRequestDefinition.java | 2 +- .../TemplateUpdateRequestDefinition.java | 2 +- 69 files changed, 3808 insertions(+), 140 deletions(-) create mode 100644 backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameter.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameterExample.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/system/mapper/OrganizationParameterMapper.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/system/mapper/OrganizationParameterMapper.xml create mode 100644 backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/DefaultFunctionalCustomField.java create mode 100644 backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/OrganizationParameterConstants.java create mode 100644 backend/framework/sdk/src/main/java/io/metersphere/sdk/util/SubListUtil.java create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectCustomFieldController.java create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/controller/ProjectTemplateController.java create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectCustomFieldLogService.java create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectCustomFieldService.java create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectTemplateLogService.java create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/service/ProjectTemplateService.java create mode 100644 backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectCustomFieldControllerTests.java create mode 100644 backend/services/project-management/src/test/java/io/metersphere/project/controller/ProjectTemplateControllerTests.java create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationCustomFieldMapper.java create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationCustomFieldMapper.xml create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationTemplateMapper.java create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationTemplateMapper.xml create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseOrganizationParameterService.java create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/service/CleanupTemplateResourceService.java create mode 100644 backend/services/system-setting/src/main/java/io/metersphere/system/service/CreateTemplateResourceService.java diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomField.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomField.java index 5dcd8b67aa..816358a94d 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomField.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomField.java @@ -51,6 +51,13 @@ public class CustomField implements Serializable { @Schema(description = "创建人") private String createUser; + @Schema(description = "项目字段所关联的组织字段ID") + private String refId; + + @Schema(description = "是否需要手动输入选项key", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{custom_field.enable_option_key.not_blank}", groups = {Created.class}) + private Boolean enableOptionKey; + @Schema(description = "组织或项目ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{custom_field.scope_id.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{custom_field.scope_id.length_range}", groups = {Created.class, Updated.class}) @@ -69,6 +76,8 @@ public class CustomField implements Serializable { createTime("create_time", "createTime", "BIGINT", false), updateTime("update_time", "updateTime", "BIGINT", false), createUser("create_user", "createUser", "VARCHAR", false), + refId("ref_id", "refId", "VARCHAR", false), + enableOptionKey("enable_option_key", "enableOptionKey", "BIT", false), scopeId("scope_id", "scopeId", "VARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomFieldExample.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomFieldExample.java index 6cda76b3c6..b6148aef65 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomFieldExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/CustomFieldExample.java @@ -774,6 +774,136 @@ public class CustomFieldExample { return (Criteria) this; } + public Criteria andRefIdIsNull() { + addCriterion("ref_id is null"); + return (Criteria) this; + } + + public Criteria andRefIdIsNotNull() { + addCriterion("ref_id is not null"); + return (Criteria) this; + } + + public Criteria andRefIdEqualTo(String value) { + addCriterion("ref_id =", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotEqualTo(String value) { + addCriterion("ref_id <>", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdGreaterThan(String value) { + addCriterion("ref_id >", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdGreaterThanOrEqualTo(String value) { + addCriterion("ref_id >=", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLessThan(String value) { + addCriterion("ref_id <", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLessThanOrEqualTo(String value) { + addCriterion("ref_id <=", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLike(String value) { + addCriterion("ref_id like", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotLike(String value) { + addCriterion("ref_id not like", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdIn(List values) { + addCriterion("ref_id in", values, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotIn(List values) { + addCriterion("ref_id not in", values, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdBetween(String value1, String value2) { + addCriterion("ref_id between", value1, value2, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotBetween(String value1, String value2) { + addCriterion("ref_id not between", value1, value2, "refId"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyIsNull() { + addCriterion("enable_option_key is null"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyIsNotNull() { + addCriterion("enable_option_key is not null"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyEqualTo(Boolean value) { + addCriterion("enable_option_key =", value, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyNotEqualTo(Boolean value) { + addCriterion("enable_option_key <>", value, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyGreaterThan(Boolean value) { + addCriterion("enable_option_key >", value, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyGreaterThanOrEqualTo(Boolean value) { + addCriterion("enable_option_key >=", value, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyLessThan(Boolean value) { + addCriterion("enable_option_key <", value, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyLessThanOrEqualTo(Boolean value) { + addCriterion("enable_option_key <=", value, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyIn(List values) { + addCriterion("enable_option_key in", values, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyNotIn(List values) { + addCriterion("enable_option_key not in", values, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyBetween(Boolean value1, Boolean value2) { + addCriterion("enable_option_key between", value1, value2, "enableOptionKey"); + return (Criteria) this; + } + + public Criteria andEnableOptionKeyNotBetween(Boolean value1, Boolean value2) { + addCriterion("enable_option_key not between", value1, value2, "enableOptionKey"); + return (Criteria) this; + } + public Criteria andScopeIdIsNull() { addCriterion("scope_id is null"); return (Criteria) this; diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameter.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameter.java new file mode 100644 index 0000000000..d8ee896a8c --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameter.java @@ -0,0 +1,100 @@ +package io.metersphere.system.domain; + +import io.metersphere.validation.groups.*; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import lombok.Data; + +@Data +public class OrganizationParameter implements Serializable { + @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{organization_parameter.organization_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{organization_parameter.organization_id.length_range}", groups = {Created.class, Updated.class}) + private String organizationId; + + @Schema(description = "配置项", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{organization_parameter.param_key.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{organization_parameter.param_key.length_range}", groups = {Created.class, Updated.class}) + private String paramKey; + + @Schema(description = "配置值") + private String paramValue; + + private static final long serialVersionUID = 1L; + + public enum Column { + organizationId("organization_id", "organizationId", "VARCHAR", false), + paramKey("param_key", "paramKey", "VARCHAR", false), + paramValue("param_value", "paramValue", "VARCHAR", false); + + private static final String BEGINNING_DELIMITER = "`"; + + private static final String ENDING_DELIMITER = "`"; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameterExample.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameterExample.java new file mode 100644 index 0000000000..84fafe90cf --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/OrganizationParameterExample.java @@ -0,0 +1,410 @@ +package io.metersphere.system.domain; + +import java.util.ArrayList; +import java.util.List; + +public class OrganizationParameterExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public OrganizationParameterExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andOrganizationIdIsNull() { + addCriterion("organization_id is null"); + return (Criteria) this; + } + + public Criteria andOrganizationIdIsNotNull() { + addCriterion("organization_id is not null"); + return (Criteria) this; + } + + public Criteria andOrganizationIdEqualTo(String value) { + addCriterion("organization_id =", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotEqualTo(String value) { + addCriterion("organization_id <>", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdGreaterThan(String value) { + addCriterion("organization_id >", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdGreaterThanOrEqualTo(String value) { + addCriterion("organization_id >=", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdLessThan(String value) { + addCriterion("organization_id <", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdLessThanOrEqualTo(String value) { + addCriterion("organization_id <=", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdLike(String value) { + addCriterion("organization_id like", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotLike(String value) { + addCriterion("organization_id not like", value, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdIn(List values) { + addCriterion("organization_id in", values, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotIn(List values) { + addCriterion("organization_id not in", values, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdBetween(String value1, String value2) { + addCriterion("organization_id between", value1, value2, "organizationId"); + return (Criteria) this; + } + + public Criteria andOrganizationIdNotBetween(String value1, String value2) { + addCriterion("organization_id not between", value1, value2, "organizationId"); + return (Criteria) this; + } + + public Criteria andParamKeyIsNull() { + addCriterion("param_key is null"); + return (Criteria) this; + } + + public Criteria andParamKeyIsNotNull() { + addCriterion("param_key is not null"); + return (Criteria) this; + } + + public Criteria andParamKeyEqualTo(String value) { + addCriterion("param_key =", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyNotEqualTo(String value) { + addCriterion("param_key <>", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyGreaterThan(String value) { + addCriterion("param_key >", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyGreaterThanOrEqualTo(String value) { + addCriterion("param_key >=", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyLessThan(String value) { + addCriterion("param_key <", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyLessThanOrEqualTo(String value) { + addCriterion("param_key <=", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyLike(String value) { + addCriterion("param_key like", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyNotLike(String value) { + addCriterion("param_key not like", value, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyIn(List values) { + addCriterion("param_key in", values, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyNotIn(List values) { + addCriterion("param_key not in", values, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyBetween(String value1, String value2) { + addCriterion("param_key between", value1, value2, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamKeyNotBetween(String value1, String value2) { + addCriterion("param_key not between", value1, value2, "paramKey"); + return (Criteria) this; + } + + public Criteria andParamValueIsNull() { + addCriterion("param_value is null"); + return (Criteria) this; + } + + public Criteria andParamValueIsNotNull() { + addCriterion("param_value is not null"); + return (Criteria) this; + } + + public Criteria andParamValueEqualTo(String value) { + addCriterion("param_value =", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueNotEqualTo(String value) { + addCriterion("param_value <>", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueGreaterThan(String value) { + addCriterion("param_value >", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueGreaterThanOrEqualTo(String value) { + addCriterion("param_value >=", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueLessThan(String value) { + addCriterion("param_value <", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueLessThanOrEqualTo(String value) { + addCriterion("param_value <=", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueLike(String value) { + addCriterion("param_value like", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueNotLike(String value) { + addCriterion("param_value not like", value, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueIn(List values) { + addCriterion("param_value in", values, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueNotIn(List values) { + addCriterion("param_value not in", values, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueBetween(String value1, String value2) { + addCriterion("param_value between", value1, value2, "paramValue"); + return (Criteria) this; + } + + public Criteria andParamValueNotBetween(String value1, String value2) { + addCriterion("param_value not between", value1, value2, "paramValue"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/Template.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/Template.java index 57c573078e..749cbc0c35 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/Template.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/Template.java @@ -50,6 +50,13 @@ public class Template implements Serializable { @NotNull(message = "{template.enable_third_part.not_blank}", groups = {Created.class}) private Boolean enableThirdPart; + @Schema(description = "是否是默认模板", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{template.enable_default.not_blank}", groups = {Created.class}) + private Boolean enableDefault; + + @Schema(description = "项目模板所关联的组织模板ID") + private String refId; + @Schema(description = "使用场景", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{template.scene.not_blank}", groups = {Created.class}) @Size(min = 1, max = 30, message = "{template.scene.length_range}", groups = {Created.class, Updated.class}) @@ -68,6 +75,8 @@ public class Template implements Serializable { scopeType("scope_type", "scopeType", "VARCHAR", false), scopeId("scope_id", "scopeId", "VARCHAR", false), enableThirdPart("enable_third_part", "enableThirdPart", "BIT", false), + enableDefault("enable_default", "enableDefault", "BIT", false), + refId("ref_id", "refId", "VARCHAR", false), scene("scene", "scene", "VARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/domain/TemplateExample.java b/backend/framework/domain/src/main/java/io/metersphere/system/domain/TemplateExample.java index 3afd16ffe4..86d1d22ecd 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/domain/TemplateExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/system/domain/TemplateExample.java @@ -764,6 +764,136 @@ public class TemplateExample { return (Criteria) this; } + public Criteria andEnableDefaultIsNull() { + addCriterion("enable_default is null"); + return (Criteria) this; + } + + public Criteria andEnableDefaultIsNotNull() { + addCriterion("enable_default is not null"); + return (Criteria) this; + } + + public Criteria andEnableDefaultEqualTo(Boolean value) { + addCriterion("enable_default =", value, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultNotEqualTo(Boolean value) { + addCriterion("enable_default <>", value, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultGreaterThan(Boolean value) { + addCriterion("enable_default >", value, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultGreaterThanOrEqualTo(Boolean value) { + addCriterion("enable_default >=", value, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultLessThan(Boolean value) { + addCriterion("enable_default <", value, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultLessThanOrEqualTo(Boolean value) { + addCriterion("enable_default <=", value, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultIn(List values) { + addCriterion("enable_default in", values, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultNotIn(List values) { + addCriterion("enable_default not in", values, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultBetween(Boolean value1, Boolean value2) { + addCriterion("enable_default between", value1, value2, "enableDefault"); + return (Criteria) this; + } + + public Criteria andEnableDefaultNotBetween(Boolean value1, Boolean value2) { + addCriterion("enable_default not between", value1, value2, "enableDefault"); + return (Criteria) this; + } + + public Criteria andRefIdIsNull() { + addCriterion("ref_id is null"); + return (Criteria) this; + } + + public Criteria andRefIdIsNotNull() { + addCriterion("ref_id is not null"); + return (Criteria) this; + } + + public Criteria andRefIdEqualTo(String value) { + addCriterion("ref_id =", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotEqualTo(String value) { + addCriterion("ref_id <>", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdGreaterThan(String value) { + addCriterion("ref_id >", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdGreaterThanOrEqualTo(String value) { + addCriterion("ref_id >=", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLessThan(String value) { + addCriterion("ref_id <", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLessThanOrEqualTo(String value) { + addCriterion("ref_id <=", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdLike(String value) { + addCriterion("ref_id like", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotLike(String value) { + addCriterion("ref_id not like", value, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdIn(List values) { + addCriterion("ref_id in", values, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotIn(List values) { + addCriterion("ref_id not in", values, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdBetween(String value1, String value2) { + addCriterion("ref_id between", value1, value2, "refId"); + return (Criteria) this; + } + + public Criteria andRefIdNotBetween(String value1, String value2) { + addCriterion("ref_id not between", value1, value2, "refId"); + return (Criteria) this; + } + public Criteria andSceneIsNull() { addCriterion("scene is null"); return (Criteria) this; diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/CustomFieldMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/CustomFieldMapper.xml index 43d443acc3..01696087c9 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/CustomFieldMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/CustomFieldMapper.xml @@ -12,6 +12,8 @@ + + @@ -74,7 +76,7 @@ id, `name`, scene, `type`, remark, internal, scope_type, create_time, update_time, - create_user, scope_id + create_user, ref_id, enable_option_key, scope_id + select + + distinct + + + from organization_parameter + + + + + order by ${orderByClause} + + + + + delete from organization_parameter + where organization_id = #{organizationId,jdbcType=VARCHAR} + and param_key = #{paramKey,jdbcType=VARCHAR} + + + delete from organization_parameter + + + + + + insert into organization_parameter (organization_id, param_key, param_value + ) + values (#{organizationId,jdbcType=VARCHAR}, #{paramKey,jdbcType=VARCHAR}, #{paramValue,jdbcType=VARCHAR} + ) + + + insert into organization_parameter + + + organization_id, + + + param_key, + + + param_value, + + + + + #{organizationId,jdbcType=VARCHAR}, + + + #{paramKey,jdbcType=VARCHAR}, + + + #{paramValue,jdbcType=VARCHAR}, + + + + + + update organization_parameter + + + organization_id = #{record.organizationId,jdbcType=VARCHAR}, + + + param_key = #{record.paramKey,jdbcType=VARCHAR}, + + + param_value = #{record.paramValue,jdbcType=VARCHAR}, + + + + + + + + update organization_parameter + set organization_id = #{record.organizationId,jdbcType=VARCHAR}, + param_key = #{record.paramKey,jdbcType=VARCHAR}, + param_value = #{record.paramValue,jdbcType=VARCHAR} + + + + + + update organization_parameter + + + param_value = #{paramValue,jdbcType=VARCHAR}, + + + where organization_id = #{organizationId,jdbcType=VARCHAR} + and param_key = #{paramKey,jdbcType=VARCHAR} + + + update organization_parameter + set param_value = #{paramValue,jdbcType=VARCHAR} + where organization_id = #{organizationId,jdbcType=VARCHAR} + and param_key = #{paramKey,jdbcType=VARCHAR} + + + insert into organization_parameter + (organization_id, param_key, param_value) + values + + (#{item.organizationId,jdbcType=VARCHAR}, #{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR} + ) + + + + insert into organization_parameter ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.organizationId,jdbcType=VARCHAR} + + + #{item.paramKey,jdbcType=VARCHAR} + + + #{item.paramValue,jdbcType=VARCHAR} + + + ) + + + \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/TemplateMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/TemplateMapper.xml index 8422057d13..311b8da9c1 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/system/mapper/TemplateMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/system/mapper/TemplateMapper.xml @@ -12,6 +12,8 @@ + + @@ -74,7 +76,7 @@ id, `name`, remark, internal, update_time, create_time, create_user, scope_type, - scope_id, enable_third_part, scene + scope_id, enable_third_part, enable_default, ref_id, scene