refactor(测试计划): 优化计划详情缺陷列表接口
This commit is contained in:
parent
1ef21305fb
commit
37098287c8
|
@ -17,8 +17,10 @@ public class TestPlanBugPageResponse {
|
||||||
private String num;
|
private String num;
|
||||||
@Schema(description = "缺陷标题")
|
@Schema(description = "缺陷标题")
|
||||||
private String title;
|
private String title;
|
||||||
|
@Schema(description = "缺陷内容(预览)")
|
||||||
|
private String content;
|
||||||
@Schema(description = "关联用例集合")
|
@Schema(description = "关联用例集合")
|
||||||
private List<TestPlanBugCaseDTO> relateCase;
|
private List<TestPlanBugCaseDTO> relateCases;
|
||||||
@Schema(description = "处理人")
|
@Schema(description = "处理人")
|
||||||
private String handleUser;
|
private String handleUser;
|
||||||
@Schema(description = "状态")
|
@Schema(description = "状态")
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="io.metersphere.plan.mapper.ExtTestPlanBugMapper">
|
<mapper namespace="io.metersphere.plan.mapper.ExtTestPlanBugMapper">
|
||||||
<select id="list" parameterType="io.metersphere.plan.dto.request.TestPlanBugPageRequest" resultType="io.metersphere.plan.dto.response.TestPlanBugPageResponse">
|
<select id="list" parameterType="io.metersphere.plan.dto.request.TestPlanBugPageRequest" resultType="io.metersphere.plan.dto.response.TestPlanBugPageResponse">
|
||||||
select b.id as id, b.num as num, b.title as title, b.handle_user handleUser, b.status as status, b.create_user createUser, b.create_time createTime
|
select b.id as id, b.num as num, b.title as title, bc.description content, b.handle_user handleUser, b.status as status, b.create_user createUser, b.create_time createTime
|
||||||
from bug_relation_case brc join bug b on brc.bug_id = b.id
|
from bug_relation_case brc join bug b on brc.bug_id = b.id
|
||||||
|
left join bug_content bc on b.id = bc.bug_id
|
||||||
where brc.test_plan_id = #{request.planId}
|
where brc.test_plan_id = #{request.planId}
|
||||||
<if test="request.keyword != null and request.keyword != ''">
|
<if test="request.keyword != null and request.keyword != ''">
|
||||||
and (
|
and (
|
||||||
|
@ -26,8 +27,8 @@
|
||||||
<select id="getBugRelatedCase" resultType="io.metersphere.plan.dto.TestPlanBugCaseDTO">
|
<select id="getBugRelatedCase" resultType="io.metersphere.plan.dto.TestPlanBugCaseDTO">
|
||||||
select brc.test_plan_case_id as id, fc.num as num, brc.bug_id as bugId, fc.name as name
|
select brc.test_plan_case_id as id, fc.num as num, brc.bug_id as bugId, fc.name as name
|
||||||
from bug_relation_case brc
|
from bug_relation_case brc
|
||||||
join functional_case fc on brc.test_plan_case_id = fc.id
|
join functional_case fc on brc.case_id = fc.id
|
||||||
# 后续会有其他用例, 根据关联用例类型, 取不同用例表
|
<!-- 后续会有其他用例, 根据关联用例类型, 取不同用例表 -->
|
||||||
where brc.test_plan_id = #{planId}
|
where brc.test_plan_id = #{planId}
|
||||||
and brc.bug_id in
|
and brc.bug_id in
|
||||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class TestPlanBugService extends TestPlanResourceService {
|
||||||
List<TestPlanBugCaseDTO> bugRelatedCases = extTestPlanBugMapper.getBugRelatedCase(bugIds, planId);
|
List<TestPlanBugCaseDTO> bugRelatedCases = extTestPlanBugMapper.getBugRelatedCase(bugIds, planId);
|
||||||
Map<String, List<TestPlanBugCaseDTO>> bugRelateCaseMap = bugRelatedCases.stream().collect(Collectors.groupingBy(TestPlanBugCaseDTO::getBugId));
|
Map<String, List<TestPlanBugCaseDTO>> bugRelateCaseMap = bugRelatedCases.stream().collect(Collectors.groupingBy(TestPlanBugCaseDTO::getBugId));
|
||||||
bugList.forEach(bug -> {
|
bugList.forEach(bug -> {
|
||||||
bug.setRelateCase(bugRelateCaseMap.get(bug.getId()));
|
bug.setRelateCases(bugRelateCaseMap.get(bug.getId()));
|
||||||
bug.setCreateUser(userMap.get(bug.getCreateUser()));
|
bug.setCreateUser(userMap.get(bug.getCreateUser()));
|
||||||
});
|
});
|
||||||
return bugList;
|
return bugList;
|
||||||
|
|
Loading…
Reference in New Issue