Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
7a6151ab
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7a6151ab
编写于
9月 18, 2020
作者:
S
shiziyuan9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(测试计划): 测试计划可以修改所属项目
上级
afcbe9bc
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
74 addition
and
14 deletion
+74
-14
backend/src/main/java/io/metersphere/track/controller/TestPlanController.java
...a/io/metersphere/track/controller/TestPlanController.java
+2
-2
backend/src/main/java/io/metersphere/track/dto/TestPlanDTO.java
...d/src/main/java/io/metersphere/track/dto/TestPlanDTO.java
+3
-0
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
...in/java/io/metersphere/track/service/TestPlanService.java
+41
-1
frontend/src/business/components/track/case/components/SwitchProject.vue
...siness/components/track/case/components/SwitchProject.vue
+1
-1
frontend/src/business/components/track/plan/components/TestPlanEdit.vue
...usiness/components/track/plan/components/TestPlanEdit.vue
+23
-8
frontend/src/business/components/track/review/components/TestCaseReviewEdit.vue
...components/track/review/components/TestCaseReviewEdit.vue
+4
-2
未找到文件。
backend/src/main/java/io/metersphere/track/controller/TestPlanController.java
浏览文件 @
7a6151ab
...
...
@@ -81,8 +81,8 @@ public class TestPlanController {
@PostMapping
(
"/edit"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
public
void
editTestPlan
(
@RequestBody
TestPlan
testPlan
)
{
testPlanService
.
editTestPlan
(
testPlan
);
public
void
editTestPlan
(
@RequestBody
TestPlan
DTO
testPlanDTO
)
{
testPlanService
.
editTestPlan
(
testPlan
DTO
);
}
@PostMapping
(
"/edit/status/{planId}"
)
...
...
backend/src/main/java/io/metersphere/track/dto/TestPlanDTO.java
浏览文件 @
7a6151ab
...
...
@@ -4,8 +4,11 @@ import io.metersphere.base.domain.TestPlan;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
@Getter
@Setter
public
class
TestPlanDTO
extends
TestPlan
{
private
String
projectName
;
private
List
<
String
>
projectIds
;
}
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
浏览文件 @
7a6151ab
...
...
@@ -34,6 +34,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.*
;
...
...
@@ -110,12 +111,51 @@ public class TestPlanService {
return
Optional
.
ofNullable
(
testPlanMapper
.
selectByPrimaryKey
(
testPlanId
)).
orElse
(
new
TestPlan
());
}
public
int
editTestPlan
(
TestPlan
testPlan
)
{
public
int
editTestPlan
(
TestPlanDTO
testPlan
)
{
editTestPlanProject
(
testPlan
);
testPlan
.
setUpdateTime
(
System
.
currentTimeMillis
());
checkTestPlanExist
(
testPlan
);
return
testPlanMapper
.
updateByPrimaryKeySelective
(
testPlan
);
}
private
void
editTestPlanProject
(
TestPlanDTO
testPlan
)
{
List
<
String
>
projectIds
=
testPlan
.
getProjectIds
();
if
(!
CollectionUtils
.
isEmpty
(
projectIds
))
{
TestPlanProjectExample
testPlanProjectExample1
=
new
TestPlanProjectExample
();
testPlanProjectExample1
.
createCriteria
().
andTestPlanIdEqualTo
(
testPlan
.
getId
());
List
<
TestPlanProject
>
testPlanProjects
=
testPlanProjectMapper
.
selectByExample
(
testPlanProjectExample1
);
// 已经关联的项目idList
List
<
String
>
dbProjectIds
=
testPlanProjects
.
stream
().
map
(
TestPlanProject:
:
getProjectId
).
collect
(
Collectors
.
toList
());
// 修改后传过来的项目idList,如果还未关联,进行关联
projectIds
.
forEach
(
projectId
->
{
if
(!
dbProjectIds
.
contains
(
projectId
))
{
TestPlanProject
testPlanProject
=
new
TestPlanProject
();
testPlanProject
.
setTestPlanId
(
testPlan
.
getId
());
testPlanProject
.
setProjectId
(
projectId
);
testPlanProjectMapper
.
insert
(
testPlanProject
);
}
});
TestPlanProjectExample
testPlanProjectExample
=
new
TestPlanProjectExample
();
testPlanProjectExample
.
createCriteria
().
andTestPlanIdEqualTo
(
testPlan
.
getId
()).
andProjectIdNotIn
(
projectIds
);
testPlanProjectMapper
.
deleteByExample
(
testPlanProjectExample
);
// 关联的项目下的用例idList
TestCaseExample
example
=
new
TestCaseExample
();
example
.
createCriteria
().
andProjectIdIn
(
projectIds
);
List
<
TestCase
>
caseList
=
testCaseMapper
.
selectByExample
(
example
);
List
<
String
>
caseIds
=
caseList
.
stream
().
map
(
TestCase:
:
getId
).
collect
(
Collectors
.
toList
());
// 取消关联所属项目下的用例和计划的关系
TestPlanTestCaseExample
testPlanTestCaseExample
=
new
TestPlanTestCaseExample
();
TestPlanTestCaseExample
.
Criteria
criteria
=
testPlanTestCaseExample
.
createCriteria
().
andPlanIdEqualTo
(
testPlan
.
getId
());
if
(!
CollectionUtils
.
isEmpty
(
caseIds
))
{
criteria
.
andCaseIdNotIn
(
caseIds
);
}
testPlanTestCaseMapper
.
deleteByExample
(
testPlanTestCaseExample
);
}
}
private
void
checkTestPlanExist
(
TestPlan
testPlan
)
{
if
(
testPlan
.
getName
()
!=
null
)
{
TestPlanExample
example
=
new
TestPlanExample
();
...
...
frontend/src/business/components/track/case/components/SwitchProject.vue
浏览文件 @
7a6151ab
...
...
@@ -4,7 +4,7 @@
:close-on-click-modal=
"false"
class=
"ms-switch-project"
>
<ms-table-header
:condition.sync=
"condition"
@
search=
"initData"
title=
""
:show-create=
"false"
/>
<ms-table-header
:condition.sync=
"condition"
@
search=
"initData"
title=
"
切换项目
"
:show-create=
"false"
/>
<el-table
:data=
"tableData"
highlight-current-row
...
...
frontend/src/business/components/track/plan/components/TestPlanEdit.vue
浏览文件 @
7a6151ab
...
...
@@ -24,7 +24,6 @@
<el-col
:span=
"11"
:offset=
"2"
>
<el-form-item
:label=
"$t('test_track.plan.plan_project')"
:label-width=
"formLabelWidth"
prop=
"projectIds"
>
<el-select
:disabled=
"(form.status == null) ? false : true"
v-model=
"form.projectIds"
:placeholder=
"$t('test_track.plan.input_plan_project')"
multiple
...
...
@@ -175,18 +174,34 @@ export default {
return
;
}
param
.
workspaceId
=
localStorage
.
getItem
(
WORKSPACE_ID
);
this
.
$post
(
'
/test/plan/
'
+
this
.
operationType
,
param
,
()
=>
{
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
this
.
dialogFormVisible
=
false
;
this
.
$emit
(
"
refresh
"
);
// 发送广播,刷新 head 上的最新列表
TrackEvent
.
$emit
(
LIST_CHANGE
);
});
if
(
this
.
operationType
===
'
edit
'
)
{
this
.
$confirm
(
'
取消项目关联会同时取消该项目下已关联的测试用例
'
,
'
提示
'
,
{
confirmButtonText
:
this
.
$t
(
'
commons.confirm
'
),
cancelButtonText
:
this
.
$t
(
'
commons.cancel
'
),
type
:
'
warning
'
}).
then
(()
=>
{
this
.
editTestPlan
(
param
);
}).
catch
(()
=>
{
this
.
$info
(
this
.
$t
(
'
commons.cancel
'
))
});
}
else
{
this
.
editTestPlan
(
param
);
}
}
else
{
return
false
;
}
});
},
editTestPlan
(
param
)
{
this
.
$post
(
'
/test/plan/
'
+
this
.
operationType
,
param
,
()
=>
{
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
this
.
dialogFormVisible
=
false
;
this
.
$emit
(
"
refresh
"
);
// 发送广播,刷新 head 上的最新列表
TrackEvent
.
$emit
(
LIST_CHANGE
);
});
},
getProjects
()
{
this
.
$get
(
"
/project/listAll
"
,
(
response
)
=>
{
if
(
response
.
success
)
{
...
...
frontend/src/business/components/track/review/components/TestCaseReviewEdit.vue
浏览文件 @
7a6151ab
...
...
@@ -6,6 +6,7 @@
:title=
"operationType === 'edit' ? '编辑用例评审' : '创建用例评审'"
:visible.sync=
"dialogFormVisible"
@
close=
"close"
v-loading=
"result.loading"
width=
"65%"
>
<el-form
:model=
"form"
:rules=
"rules"
ref=
"reviewForm"
>
...
...
@@ -122,6 +123,7 @@ export default {
data
()
{
return
{
dialogFormVisible
:
false
,
result
:
{},
form
:
{
name
:
''
,
projectIds
:
[],
...
...
@@ -187,7 +189,7 @@ export default {
});
},
getProjects
()
{
this
.
$get
(
"
/project/listAll
"
,
(
response
)
=>
{
this
.
result
=
this
.
$get
(
"
/project/listAll
"
,
(
response
)
=>
{
if
(
response
.
success
)
{
this
.
projects
=
response
.
data
;
}
else
{
...
...
@@ -197,7 +199,7 @@ export default {
},
setReviewerOptions
()
{
let
workspaceId
=
localStorage
.
getItem
(
WORKSPACE_ID
);
this
.
$post
(
'
/user/ws/member/tester/list
'
,
{
workspaceId
:
workspaceId
},
response
=>
{
this
.
result
=
this
.
$post
(
'
/user/ws/member/tester/list
'
,
{
workspaceId
:
workspaceId
},
response
=>
{
this
.
reviewerOptions
=
response
.
data
;
});
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录