fix(测试跟踪): 缺陷模板默认值展示问题

--bug=1016830 --user=宋昌昌 【测试跟踪】缺陷模板里设置了整型字段默认值1,创建缺陷时默认显示了0 https://www.tapd.cn/55049933/s/1244852
This commit is contained in:
song-cc-rock 2022-09-19 14:22:28 +08:00 committed by f2c-ci-robot[bot]
parent af86c9f355
commit 09609ad839
3 changed files with 13 additions and 1 deletions

View File

@ -10,6 +10,8 @@ import java.util.List;
public interface ExtCustomFieldTemplateMapper {
List<String> getCustomFieldIds(@Param("templateId") String templateId);
List<CustomFieldTemplate> getCustomFields(@Param("templateId") String templateId);
List<CustomFieldTemplateDao> list(@Param("request") CustomFieldTemplate request);
List<CustomFieldDao> lisSimple(@Param("request") CustomFieldTemplate request);

View File

@ -7,6 +7,13 @@
from custom_field_template
where custom_field_template.template_id = #{templateId}
</select>
<select id="getCustomFields" resultType="io.metersphere.base.domain.CustomFieldTemplate">
select id, field_id fieldId, template_id templateId, scene, required, `order`, default_value defaultValue, custom_data customData, `key`
from custom_field_template
where custom_field_template.template_id = #{templateId}
</select>
<select id="list" resultType="io.metersphere.dto.CustomFieldTemplateDao">
select
field_id, template_id, required, default_value, custom_data,

View File

@ -11,6 +11,7 @@ import io.metersphere.base.mapper.CustomFieldIssuesMapper;
import io.metersphere.base.mapper.CustomFieldMapper;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.ext.ExtCustomFieldMapper;
import io.metersphere.base.mapper.ext.ExtCustomFieldTemplateMapper;
import io.metersphere.commons.constants.CustomFieldType;
import io.metersphere.commons.constants.TemplateConstants;
import io.metersphere.commons.exception.MSException;
@ -62,6 +63,8 @@ public class CustomFieldService {
private ProjectMapper projectMapper;
@Resource
private CustomFieldIssuesMapper customFieldIssuesMapper;
@Resource
private ExtCustomFieldTemplateMapper extCustomFieldTemplateMapper;
public String add(CustomField customField) {
checkExist(customField);
@ -136,7 +139,7 @@ public class CustomFieldService {
}
public List<CustomFieldDao> getCustomFieldByTemplateId(String templateId) {
List<CustomFieldTemplate> customFields = customFieldTemplateService.getCustomFields(templateId);
List<CustomFieldTemplate> customFields = extCustomFieldTemplateMapper.getCustomFields(templateId);
List<String> fieldIds = customFields.stream()
.map(CustomFieldTemplate::getFieldId)
.collect(Collectors.toList());