From 29b45409a2fdb702e79a40cbf5b1fb959f7be778 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 9 Nov 2022 14:19:24 +0800 Subject: [PATCH] =?UTF-8?q?revert(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E9=A6=96=E9=A1=B5=E9=81=97=E7=95=99=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=80=BB=E6=95=B0=E5=92=8C=E5=8D=A0=E6=AF=94?= =?UTF-8?q?=E6=9C=89=E7=BB=9F=E8=AE=A1=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 23afe758050d9fb33df32af4e886573528fcf431. --- .../service/BaseCustomFieldService.java | 40 ++----------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseCustomFieldService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseCustomFieldService.java index 701ac7927b..2a5b0cc816 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseCustomFieldService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/BaseCustomFieldService.java @@ -1,9 +1,8 @@ package io.metersphere.service; -import io.metersphere.base.domain.*; +import io.metersphere.base.domain.CustomField; +import io.metersphere.base.domain.CustomFieldExample; import io.metersphere.base.mapper.CustomFieldMapper; -import io.metersphere.base.mapper.CustomFieldTemplateMapper; -import io.metersphere.base.mapper.ProjectMapper; import io.metersphere.base.mapper.ext.BaseCustomFieldMapper; import io.metersphere.commons.constants.CustomFieldType; import io.metersphere.commons.utils.JSON; @@ -30,11 +29,6 @@ public class BaseCustomFieldService { @Resource CustomFieldMapper customFieldMapper; - @Resource - private ProjectMapper projectMapper; - @Resource - private CustomFieldTemplateMapper customFieldTemplateMapper; - public CustomField get(String id) { return customFieldMapper.selectByPrimaryKey(id); } @@ -108,41 +102,13 @@ public class BaseCustomFieldService { } public CustomField getCustomFieldByName(String projectId, String fieldName) { - Project project = projectMapper.selectByPrimaryKey(projectId); - if (project == null) { - return null; - } - - String issueTemplateId = project.getIssueTemplateId(); - if (StringUtils.isBlank(issueTemplateId)) { - return null; - } - - CustomFieldTemplateExample customFieldTemplateExample = new CustomFieldTemplateExample(); - customFieldTemplateExample.createCriteria().andTemplateIdEqualTo(issueTemplateId); - List customFieldTemplates = customFieldTemplateMapper.selectByExample(customFieldTemplateExample); - if (CollectionUtils.isEmpty(customFieldTemplates)) { - return null; - } - - List templateFieldIds = customFieldTemplates - .stream() - .map(CustomFieldTemplate::getFieldId) - .collect(Collectors.toList()); - CustomFieldExample example = new CustomFieldExample(); example.createCriteria() .andProjectIdEqualTo(projectId) .andNameEqualTo(fieldName); - List customFields = customFieldMapper.selectByExample(example); if (CollectionUtils.isNotEmpty(customFields)) { - for (CustomField customField : customFields) { - if (templateFieldIds.contains(customField.getId())) { - return customField; - } - } - return null; + return customFields.get(0); } else { example.clear(); example.createCriteria()