refactor(功能用例): 功能用例关联缺陷列表返回字段新增属性
This commit is contained in:
parent
281e1e0b17
commit
d14c30cdb2
|
@ -15,9 +15,12 @@ public class BugProviderDTO implements Serializable {
|
|||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "缺陷id")
|
||||
@Schema(description = "id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "bugId")
|
||||
private String bugId;
|
||||
|
||||
@Schema(description = "缺陷名称")
|
||||
private String name;
|
||||
|
||||
|
@ -35,4 +38,13 @@ public class BugProviderDTO implements Serializable {
|
|||
|
||||
@Schema(description = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@Schema(description = "计划名称")
|
||||
private String testPlanName;
|
||||
|
||||
@Schema(description = "计划id")
|
||||
private String testPlanId;
|
||||
|
||||
@Schema(description = "来源")
|
||||
private String source;
|
||||
}
|
||||
|
|
|
@ -118,3 +118,5 @@ bug.export.system.other.columns.case_count=Case count
|
|||
bug.export.system.other.columns.comment=Comment
|
||||
bug.export.system.other.columns.platform=Platform
|
||||
permission.bug.name=Bug management
|
||||
test_plan_related=Test plan related
|
||||
direct_related=Direct related
|
|
@ -118,3 +118,5 @@ bug.export.system.other.columns.case_count=用例数
|
|||
bug.export.system.other.columns.comment=评论
|
||||
bug.export.system.other.columns.platform=所属平台
|
||||
permission.bug.name=缺陷管理
|
||||
test_plan_relate=测试计划关联
|
||||
direct_related=直接关联
|
|
@ -119,3 +119,5 @@ bug.export.system.other.columns.case_count=用例數
|
|||
bug.export.system.other.columns.comment=評論
|
||||
bug.export.system.other.columns.platform=所屬平台
|
||||
permission.bug.name=缺陷管理
|
||||
test_plan_related=測試計劃關聯
|
||||
direct_related=直接關聯
|
|
@ -22,14 +22,17 @@
|
|||
|
||||
<select id="getAssociateBugs" resultType="io.metersphere.dto.BugProviderDTO">
|
||||
SELECT
|
||||
brc.bug_id id,
|
||||
b.title NAME,
|
||||
brc.id id,
|
||||
brc.bug_id bugId,
|
||||
b.title name,
|
||||
b.handle_user handleUser,
|
||||
b.`status`,
|
||||
brc.test_plan_id
|
||||
brc.test_plan_id testPlanId,
|
||||
tp.name testPlanName
|
||||
FROM
|
||||
bug_relation_case brc
|
||||
INNER JOIN bug b ON brc.bug_id = b.id
|
||||
left join test_plan tp on brc.test_plan_id = tp.id
|
||||
where b.deleted = false
|
||||
<include refid="queryWhereConditionByProvider"/>
|
||||
order by
|
||||
|
|
|
@ -11,9 +11,11 @@ import io.metersphere.provider.BaseAssociateBugProvider;
|
|||
import io.metersphere.request.AssociateBugPageRequest;
|
||||
import io.metersphere.request.AssociateBugRequest;
|
||||
import io.metersphere.request.BugPageProviderRequest;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -75,7 +77,15 @@ public class AssociateBugProvider implements BaseAssociateBugProvider {
|
|||
|
||||
@Override
|
||||
public List<BugProviderDTO> hasAssociateBugPage(AssociateBugPageRequest request) {
|
||||
return extBugRelateCaseMapper.getAssociateBugs(request, request.getSortString());
|
||||
List<BugProviderDTO> associateBugs = extBugRelateCaseMapper.getAssociateBugs(request, request.getSortString());
|
||||
//TODO 需要转义状态和处理人属性
|
||||
associateBugs.stream().forEach(item -> {
|
||||
if (StringUtils.isNotBlank(item.getTestPlanName())) {
|
||||
item.setSource(Translator.get("test_plan_relate"));
|
||||
} else {
|
||||
item.setSource(Translator.get("direct_related"));
|
||||
}
|
||||
});
|
||||
return associateBugs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,5 +86,9 @@ public class AssociateBugProviderTests extends BaseTest {
|
|||
request.setPageSize(10);
|
||||
request.setCaseId("123");
|
||||
associateBugProvider.hasAssociateBugPage(request);
|
||||
request.setCaseId("wx_2");
|
||||
associateBugProvider.hasAssociateBugPage(request);
|
||||
request.setCaseId("wx_3");
|
||||
associateBugProvider.hasAssociateBugPage(request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,4 +6,7 @@ INSERT INTO bug (id, num, title, handle_users, handle_user, create_user, create_
|
|||
INSERT INTO bug_relation_case(id, case_id, bug_id, case_type, test_plan_id, test_plan_case_id, create_user, create_time, update_time)
|
||||
VALUES ('wx_test_id_1', 'wx_1', 'bug_id_1', 'FUNCTIONAL', null, null, 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000),
|
||||
('wx_test_id_2', 'wx_2', 'bug_id_1', 'FUNCTIONAL', 'test-plan-id', 'bug_relate_case', 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000),
|
||||
('wx_test_id_3', 'wx_3', 'bug_id_2', 'FUNCTIONAL', 'test-plan-id', 'bug_relate_case-1', 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000);
|
||||
('wx_test_id_3', 'wx_3', 'bug_id_2', 'FUNCTIONAL', null, null, 'admin', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000);
|
||||
|
||||
INSERT INTO `test_plan` (`id`,`project_id`,`parent_id`,`name`,`status`,`stage`,`create_time`,`create_user`)
|
||||
VALUES('test-plan-id','wx_test','3','cececec','3','4',UNIX_TIMESTAMP() * 1000,'admin');
|
Loading…
Reference in New Issue