Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaofang li
MeterSphere
Commits
174c06ae
Commit
174c06ae
authored
3 years ago
by
chenjianxing
Committed by
zhangdahai112
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix(测试跟踪): 功能用例缺陷与测试计划缺陷分离
parent
45b89410
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.java
+2
-0
.../java/io/metersphere/base/mapper/ext/ExtIssuesMapper.java
backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml
+31
-10
...n/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml
backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml
+2
-2
.../java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
+2
-2
...java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
backend/src/main/java/io/metersphere/controller/ShareController.java
+1
-1
.../main/java/io/metersphere/controller/ShareController.java
backend/src/main/java/io/metersphere/track/controller/IssuesController.java
+1
-1
...ava/io/metersphere/track/controller/IssuesController.java
backend/src/main/java/io/metersphere/track/request/testcase/IssuesRequest.java
+2
-0
.../io/metersphere/track/request/testcase/IssuesRequest.java
backend/src/main/java/io/metersphere/track/service/IssuesService.java
+27
-10
...main/java/io/metersphere/track/service/IssuesService.java
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+1
-1
...in/java/io/metersphere/track/service/TestPlanService.java
frontend/src/business/components/track/case/components/IssueRelateList.vue
+2
-1
...ness/components/track/case/components/IssueRelateList.vue
frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue
+4
-0
.../components/track/case/components/TestCaseIssueRelate.vue
frontend/src/business/components/track/issue/TestCaseIssueList.vue
+9
-0
...src/business/components/track/issue/TestCaseIssueList.vue
frontend/src/business/components/track/issue/TestCaseRelateList.vue
+7
-0
...rc/business/components/track/issue/TestCaseRelateList.vue
with
91 additions
and
28 deletions
+91
-28
backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.java
+
2
-
0
View file @
174c06ae
...
...
@@ -27,4 +27,6 @@ public interface ExtIssuesMapper {
List
<
IssuesDao
>
getCountByStatus
(
@Param
(
"request"
)
IssuesRequest
issuesRequest
);
List
<
String
>
selectIdNotInUuIds
(
@Param
(
"projectId"
)
String
projectId
,
@Param
(
"platform"
)
String
platform
,
@Param
(
"platformIds"
)
List
<
String
>
platformIds
);
List
<
IssuesDao
>
getPlanIssues
(
@Param
(
"request"
)
IssuesRequest
issueRequest
);
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml
+
31
-
10
View file @
174c06ae
...
...
@@ -8,7 +8,6 @@
inner join test_case_issues
on test_case_issues.issues_id = issues.id
<include
refid=
"queryWhereCondition"
/>
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
<include
refid=
"io.metersphere.base.mapper.ext.ExtBaseMapper.orders"
/>
</select>
...
...
@@ -37,20 +36,38 @@
order by num asc
</select>
<sql
id=
"Issue_List_Column"
>
issues.id, issues.platform_id, issues.num, ifnull(issues.title, '') as title, issues.project_id, issues.create_time, issues.update_time,
ifnull(issues.description, '') as description, issues.status, issues.platform, issues.custom_fields, issues.reporter,
issues.creator,issues.resource_id,issues.platform_status,
issues.lastmodify
</sql>
<select
id=
"getIssues"
resultType=
"io.metersphere.base.domain.IssuesDao"
>
select issues.id, issues.platform_id, issues.num, ifnull(issues.title, '') as title, issues.project_id, issues.create_time, issues.update_time,
ifnull(issues.description, '') as description, issues.status, issues.platform, issues.custom_fields, issues.reporter,
issues.creator,issues.resource_id,issues.platform_status,
issues.lastmodify
select
<include
refid=
"Issue_List_Column"
/>
from issues
<if
test=
"request.projectId != null||request.workspaceId != null"
>
left join
project on issues.project_id = project.id
</if>
<include
refid=
"queryWhereCondition"
/>
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
<include
refid=
"io.metersphere.base.mapper.ext.ExtBaseMapper.orders"
/>
</select>
<select
id=
"getPlanIssues"
resultType=
"io.metersphere.base.domain.IssuesDao"
>
select
<include
refid=
"Issue_List_Column"
/>
from issues
inner join test_case_issues
on issues.id = test_case_issues.issues_id and test_case_issues.ref_type = 'PLAN_FUNCTIONAL'
and test_case_issues.resource_id in (
select id from test_plan_test_case tptc where plan_id = #{request.planId}
)
<include
refid=
"queryWhereCondition"
/>
<include
refid=
"io.metersphere.base.mapper.ext.ExtBaseMapper.orders"
/>
</select>
<select
id=
"getNextNum"
resultType=
"io.metersphere.base.domain.Issues"
>
SELECT * FROM issues WHERE issues.project_id = #{projectId} ORDER BY num DESC LIMIT 1;
</select>
...
...
@@ -66,10 +83,8 @@
issues.lastmodify
from issues
left join
test_case_issues on issues.id = test_case_issues.issues_id
test_case_issues on issues.id = test_case_issues.issues_id
and issues.project_id = #{request.projectId}
<include
refid=
"queryWhereCondition"
/>
and (test_case_issues.resource_id is null or test_case_issues.resource_id != #{request.caseResourceId})
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
<include
refid=
"io.metersphere.base.mapper.ext.ExtBaseMapper.orders"
/>
group by issues.id
</select>
...
...
@@ -130,6 +145,12 @@
<if
test=
"request.id != null and request.id != ''"
>
and issues.id = #{request.id}
</if>
<if
test=
"request.notInIds != null and request.notInIds.size() > 0"
>
and issues.id not in
<foreach
collection=
"request.notInIds"
item=
"value"
separator=
","
open=
"("
close=
")"
>
#{value}
</foreach>
</if>
<if
test=
"request.filters != null and request.filters.size() > 0"
>
<foreach
collection=
"request.filters.entrySet()"
index=
"key"
item=
"values"
>
...
...
@@ -157,7 +178,7 @@
</if>
</foreach>
</if>
and (issues.platform_status != 'delete' or issues.platform_status is NULL)
</where>
</sql>
<sql
id=
"combine"
>
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml
+
2
-
2
View file @
174c06ae
...
...
@@ -249,8 +249,8 @@
<select
id=
"getProjectPlanBugSize"
resultType=
"java.lang.Integer"
>
select count(distinct (tci.issues_id))
from test_plan_test_case tptc
join test_case_issues tci on tptc.
case_
id = tci.resource_id
right join test_case on test_case.id = tci.re
source
_id
join test_case_issues tci on tptc.id = tci.resource_id
right join test_case on test_case.id = tci.re
f
_id
join issues on tci.issues_id = issues.id
join test_plan on tptc.plan_id = test_plan.id
where test_plan.project_id = #{projectId}
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
+
2
-
2
View file @
174c06ae
...
...
@@ -724,9 +724,9 @@
<select
id=
"getTestPlanBug"
resultType=
"int"
>
select count(distinct (tci.issues_id))
from test_plan_test_case tptc
join test_case_issues tci on tptc.
case_
id = tci.resource_id
join test_case_issues tci on tptc.id = tci.resource_id
right join test_case
on test_case.id = tci.re
source
_id
on test_case.id = tci.re
f
_id
join issues
on tci.issues_id = issues.id
where tptc.plan_id = #{planId}
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/controller/ShareController.java
+
1
-
1
View file @
174c06ae
...
...
@@ -74,7 +74,7 @@ public class ShareController {
@GetMapping
(
"/issues/plan/get/{shareId}/{planId}"
)
public
List
<
IssuesDao
>
getIssuesByPlanoId
(
@PathVariable
String
shareId
,
@PathVariable
String
planId
)
{
shareInfoService
.
validate
(
shareId
,
planId
);
return
issuesService
.
getIssuesByPlan
o
Id
(
planId
);
return
issuesService
.
getIssuesByPlanId
(
planId
);
}
@GetMapping
(
"/test/plan/report/{shareId}/{planId}"
)
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/controller/IssuesController.java
+
1
-
1
View file @
174c06ae
...
...
@@ -82,7 +82,7 @@ public class IssuesController {
@GetMapping
(
"/plan/get/{planId}"
)
@RequiresPermissions
(
PermissionConstants
.
PROJECT_TRACK_ISSUE_READ
)
public
List
<
IssuesDao
>
getIssuesByPlanId
(
@PathVariable
String
planId
)
{
return
issuesService
.
getIssuesByPlan
o
Id
(
planId
);
return
issuesService
.
getIssuesByPlanId
(
planId
);
}
@GetMapping
(
"/auth/{workspaceId}/{platform}"
)
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/request/testcase/IssuesRequest.java
+
2
-
0
View file @
174c06ae
...
...
@@ -43,9 +43,11 @@ public class IssuesRequest extends BaseQueryRequest {
private
String
platform
;
private
String
customFields
;
private
List
<
String
>
testCaseIds
;
private
List
<
String
>
notInIds
;
private
String
requestType
;
private
String
status
;
private
String
defaultCustomFields
;
private
Boolean
isPlanEdit
=
false
;
private
String
planId
;
}
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/service/IssuesService.java
+
27
-
10
View file @
174c06ae
...
...
@@ -273,7 +273,7 @@ public class IssuesService {
example
.
createCriteria
().
andIssuesIdEqualTo
(
id
);
List
<
TestCaseIssues
>
testCaseIssues
=
testCaseIssuesMapper
.
selectByExample
(
example
);
testCaseIssues
.
forEach
(
i
->
{
if
(
i
.
getRefType
().
equals
(
IssueRefType
.
PLAN_FUNCTIONAL
))
{
if
(
i
.
getRefType
().
equals
(
IssueRefType
.
PLAN_FUNCTIONAL
.
name
()
))
{
testCaseIssueService
.
updateIssuesCount
(
i
.
getResourceId
());
}
});
...
...
@@ -336,14 +336,21 @@ public class IssuesService {
if
(
planMap
.
get
(
item
.
getResourceId
())
!=
null
)
{
item
.
setResourceName
(
planMap
.
get
(
item
.
getResourceId
()));
}
TestCaseIssuesExample
example
=
new
TestCaseIssuesExample
();
example
.
createCriteria
().
andIssuesIdEqualTo
(
item
.
getId
());
List
<
TestCaseIssues
>
testCaseIssues
=
testCaseIssuesMapper
.
selectByExample
(
example
);
List
<
String
>
caseIds
=
testCaseIssues
.
stream
()
.
map
(
TestCaseIssues:
:
getResourceId
)
.
collect
(
Collectors
.
toList
());
item
.
setCaseIds
(
caseIds
);
item
.
setCaseCount
(
testCaseIssues
.
size
());
Set
<
String
>
caseIdSet
=
new
HashSet
<>();
testCaseIssues
.
forEach
(
i
->
{
if
(
i
.
getRefType
().
equals
(
IssueRefType
.
PLAN_FUNCTIONAL
.
name
()))
{
caseIdSet
.
add
(
i
.
getRefId
());
}
else
{
caseIdSet
.
add
(
i
.
getResourceId
());
}
});
item
.
setCaseIds
(
new
ArrayList
<>(
caseIdSet
));
item
.
setCaseCount
(
caseIdSet
.
size
());
try
{
if
(
StringUtils
.
equals
(
item
.
getPlatform
(),
IssuesManagePlatform
.
Tapd
.
name
()))
{
TapdPlatform
platform
=
(
TapdPlatform
)
IssueFactory
.
createPlatform
(
item
.
getPlatform
(),
request
);
...
...
@@ -541,7 +548,7 @@ public class IssuesService {
}
public
List
<
IssuesDao
>
relateList
(
IssuesRequest
request
)
{
return
extIssuesMapper
.
get
Relate
Issues
(
request
);
return
extIssuesMapper
.
getIssues
(
request
);
}
public
void
userAuth
(
AuthUserIssueRequest
authUserIssueRequest
)
{
...
...
@@ -578,10 +585,20 @@ public class IssuesService {
functionResult
.
setIssueData
(
statusResult
);
}
public
List
<
IssuesDao
>
getIssuesByPlan
o
Id
(
String
planId
)
{
public
List
<
IssuesDao
>
getIssuesByPlanId
(
String
planId
)
{
IssuesRequest
issueRequest
=
new
IssuesRequest
();
issueRequest
.
setResourceId
(
planId
);
return
extIssuesMapper
.
getIssues
(
issueRequest
);
issueRequest
.
setPlanId
(
planId
);
List
<
IssuesDao
>
planIssues
=
extIssuesMapper
.
getPlanIssues
(
issueRequest
);
Set
<
String
>
ids
=
new
HashSet
<>(
planIssues
.
size
());
Iterator
<
IssuesDao
>
iterator
=
planIssues
.
iterator
();
while
(
iterator
.
hasNext
())
{
IssuesDao
next
=
iterator
.
next
();
if
(
ids
.
contains
(
next
.
getId
()))
{
iterator
.
remove
();
}
ids
.
add
(
next
.
getId
());
}
return
planIssues
;
}
public
void
changeStatus
(
IssuesRequest
request
)
{
...
...
This diff is collapsed.
Click to expand it.
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
+
1
-
1
View file @
174c06ae
...
...
@@ -1397,7 +1397,7 @@ public class TestPlanService {
report
.
setFunctionFailureCases
(
failureCases
);
}
if
(
checkReportConfig
(
config
,
"functional"
,
"issue"
))
{
List
<
IssuesDao
>
issueList
=
issuesService
.
getIssuesByPlan
o
Id
(
planId
);
List
<
IssuesDao
>
issueList
=
issuesService
.
getIssuesByPlanId
(
planId
);
report
.
setIssueList
(
issueList
);
}
}
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/case/components/IssueRelateList.vue
+
2
-
1
View file @
174c06ae
...
...
@@ -93,6 +93,7 @@ export default {
props
:
{
caseId
:
String
,
planCaseId
:
String
,
notInIds
:
Array
,
},
created
()
{
isThirdPartEnable
((
data
)
=>
{
...
...
@@ -106,7 +107,7 @@ export default {
},
getIssues
()
{
this
.
page
.
condition
.
projectId
=
this
.
projectId
;
this
.
page
.
condition
.
caseResource
Id
=
this
.
getCaseResourceId
()
;
this
.
page
.
condition
.
notIn
Id
s
=
this
.
notInIds
;
this
.
page
.
result
=
getRelateIssues
(
this
.
page
);
},
getCaseResourceId
()
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue
+
4
-
0
View file @
174c06ae
...
...
@@ -95,6 +95,7 @@
<IssueRelateList
:plan-case-id=
"planCaseId"
:case-id=
"caseId"
:not-in-ids=
"notInIds"
@
refresh=
"getIssues"
ref=
"issueRelate"
/>
</div>
...
...
@@ -145,6 +146,9 @@ export default {
issueStatusMap
()
{
return
ISSUE_STATUS_MAP
;
},
notInIds
()
{
return
this
.
page
.
data
?
this
.
page
.
data
.
map
(
i
=>
i
.
id
)
:
[];
}
},
created
()
{
getIssuePartTemplateWithProject
((
template
,
project
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/issue/TestCaseIssueList.vue
+
9
-
0
View file @
174c06ae
...
...
@@ -50,6 +50,7 @@
</ms-table>
<test-case-relate-list
:test-case-contain-ids=
"testCaseContainIds"
@
refresh=
"initTableData"
@
save=
"handleRelate"
ref=
"testCaseRelevance"
/>
...
...
@@ -72,6 +73,7 @@ export default {
tableData
:
[],
deleteIds
:
new
Set
(),
addIds
:
new
Set
(),
testCaseContainIds
:
new
Set
(),
operators
:
[
{
tip
:
this
.
$t
(
'
commons.delete
'
),
icon
:
"
el-icon-delete
"
,
type
:
"
danger
"
,
...
...
@@ -85,6 +87,7 @@ export default {
},
methods
:
{
handleDelete
(
item
,
index
)
{
this
.
testCaseContainIds
.
delete
(
item
.
id
);
this
.
tableData
.
splice
(
index
,
1
);
this
.
deleteIds
.
add
(
item
.
id
);
},
...
...
@@ -96,6 +99,9 @@ export default {
if
(
this
.
issuesId
)
{
this
.
result
=
this
.
$post
(
'
test/case/issues/list
'
,
condition
,
response
=>
{
this
.
tableData
=
response
.
data
;
this
.
tableData
.
forEach
(
item
=>
{
this
.
testCaseContainIds
.
add
(
item
.
id
);
});
this
.
$refs
.
table
.
reloadTable
();
});
}
...
...
@@ -106,6 +112,9 @@ export default {
handleRelate
(
selectRows
)
{
let
selectData
=
Array
.
from
(
selectRows
);
selectRows
.
forEach
(
i
=>
{
if
(
i
.
id
)
{
this
.
testCaseContainIds
.
add
(
i
.
id
);
}
this
.
deleteIds
.
delete
(
i
.
id
);
this
.
addIds
.
add
(
i
.
id
);
});
...
...
This diff is collapsed.
Click to expand it.
frontend/src/business/components/track/issue/TestCaseRelateList.vue
+
7
-
0
View file @
174c06ae
...
...
@@ -107,6 +107,12 @@ export default {
selectNodeIds
:
[],
};
},
props
:
{
testCaseContainIds
:
{
type
:
Set
,
default
:
new
Set
()
}
},
watch
:
{
selectNodeIds
()
{
this
.
initTableData
();
...
...
@@ -132,6 +138,7 @@ export default {
if
(
this
.
projectId
)
{
this
.
getProjectNode
();
this
.
condition
.
projectId
=
this
.
projectId
;
this
.
condition
.
testCaseContainIds
=
Array
.
from
(
this
.
testCaseContainIds
)
this
.
result
=
this
.
$post
(
'
/test/case/relate/issue/
'
+
+
this
.
currentPage
+
'
/
'
+
this
.
pageSize
,
this
.
condition
,
response
=>
{
let
data
=
response
.
data
;
this
.
total
=
data
.
itemCount
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment