Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
94dd8372
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,发现更多精彩内容 >>
提交
94dd8372
编写于
5月 21, 2020
作者:
W
wenyann
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev' into dev
上级
0560f85b
6a783499
变更
46
隐藏空白更改
内联
并排
Showing
46 changed file
with
805 addition
and
314 deletion
+805
-314
backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java
...a/io/metersphere/api/jmeter/APIBackendListenerClient.java
+4
-4
backend/src/main/java/io/metersphere/api/jmeter/ScenarioResult.java
...c/main/java/io/metersphere/api/jmeter/ScenarioResult.java
+2
-0
backend/src/main/java/io/metersphere/base/domain/LoadTestReport.java
.../main/java/io/metersphere/base/domain/LoadTestReport.java
+2
-0
backend/src/main/java/io/metersphere/base/domain/LoadTestReportDetail.java
...java/io/metersphere/base/domain/LoadTestReportDetail.java
+5
-3
backend/src/main/java/io/metersphere/base/domain/LoadTestReportDetailExample.java
.../metersphere/base/domain/LoadTestReportDetailExample.java
+60
-0
backend/src/main/java/io/metersphere/base/domain/LoadTestReportDetailKey.java
...a/io/metersphere/base/domain/LoadTestReportDetailKey.java
+14
-0
backend/src/main/java/io/metersphere/base/domain/LoadTestReportLog.java
...in/java/io/metersphere/base/domain/LoadTestReportLog.java
+2
-0
backend/src/main/java/io/metersphere/base/domain/LoadTestReportLogExample.java
.../io/metersphere/base/domain/LoadTestReportLogExample.java
+60
-0
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportDetailMapper.java
...o/metersphere/base/mapper/LoadTestReportDetailMapper.java
+3
-2
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportDetailMapper.xml
...io/metersphere/base/mapper/LoadTestReportDetailMapper.xml
+68
-49
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportLogMapper.xml
...va/io/metersphere/base/mapper/LoadTestReportLogMapper.xml
+92
-72
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.java
...java/io/metersphere/base/mapper/LoadTestReportMapper.java
+8
-9
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.xml
.../java/io/metersphere/base/mapper/LoadTestReportMapper.xml
+47
-62
backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.java
.../metersphere/base/mapper/ext/ExtLoadTestReportMapper.java
+0
-2
backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml
...o/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml
+0
-6
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java
...etersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java
+2
-1
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
...metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
+5
-1
backend/src/main/java/io/metersphere/controller/RoleController.java
...c/main/java/io/metersphere/controller/RoleController.java
+5
-0
backend/src/main/java/io/metersphere/controller/UserController.java
...c/main/java/io/metersphere/controller/UserController.java
+5
-7
backend/src/main/java/io/metersphere/controller/UserRoleController.java
...in/java/io/metersphere/controller/UserRoleController.java
+9
-2
backend/src/main/java/io/metersphere/controller/WorkspaceController.java
...n/java/io/metersphere/controller/WorkspaceController.java
+5
-0
backend/src/main/java/io/metersphere/controller/request/member/UserRequest.java
...io/metersphere/controller/request/member/UserRequest.java
+16
-0
backend/src/main/java/io/metersphere/dto/LogDetailDTO.java
backend/src/main/java/io/metersphere/dto/LogDetailDTO.java
+1
-1
backend/src/main/java/io/metersphere/excel/listener/EasyExcelListener.java
...java/io/metersphere/excel/listener/EasyExcelListener.java
+5
-2
backend/src/main/java/io/metersphere/excel/utils/EasyExcelExporter.java
...in/java/io/metersphere/excel/utils/EasyExcelExporter.java
+12
-6
backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java
...e/performance/controller/PerformanceReportController.java
+3
-3
backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java
...tersphere/performance/service/PerformanceTestService.java
+5
-16
backend/src/main/java/io/metersphere/performance/service/ReportService.java
...ava/io/metersphere/performance/service/ReportService.java
+30
-20
backend/src/main/java/io/metersphere/service/RoleService.java
...end/src/main/java/io/metersphere/service/RoleService.java
+7
-0
backend/src/main/java/io/metersphere/service/UserRoleService.java
...src/main/java/io/metersphere/service/UserRoleService.java
+34
-0
backend/src/main/java/io/metersphere/service/UserService.java
...end/src/main/java/io/metersphere/service/UserService.java
+54
-6
backend/src/main/java/io/metersphere/track/service/TestCaseService.java
...in/java/io/metersphere/track/service/TestCaseService.java
+2
-2
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
...in/java/io/metersphere/track/service/TestPlanService.java
+5
-5
backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java
...io/metersphere/track/service/TestPlanTestCaseService.java
+7
-2
backend/src/main/resources/db/migration/V2__metersphere_ddl.sql
...d/src/main/resources/db/migration/V2__metersphere_ddl.sql
+7
-9
backend/src/main/resources/generatorConfig.xml
backend/src/main/resources/generatorConfig.xml
+1
-1
frontend/src/business/components/api/home/ApiTestRecentList.vue
...nd/src/business/components/api/home/ApiTestRecentList.vue
+1
-1
frontend/src/business/components/api/test/ApiTestList.vue
frontend/src/business/components/api/test/ApiTestList.vue
+1
-1
frontend/src/business/components/performance/home/PerformanceTestRecentList.vue
...components/performance/home/PerformanceTestRecentList.vue
+1
-1
frontend/src/business/components/performance/report/components/LogDetails.vue
...s/components/performance/report/components/LogDetails.vue
+2
-2
frontend/src/business/components/settings/system/User.vue
frontend/src/business/components/settings/system/User.vue
+184
-8
frontend/src/business/components/track/case/components/TestCaseEdit.vue
...usiness/components/track/case/components/TestCaseEdit.vue
+15
-4
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue
...onents/track/plan/view/comonents/TestPlanTestCaseEdit.vue
+11
-4
frontend/src/i18n/en-US.js
frontend/src/i18n/en-US.js
+1
-0
frontend/src/i18n/zh-CN.js
frontend/src/i18n/zh-CN.js
+1
-0
frontend/src/i18n/zh-TW.js
frontend/src/i18n/zh-TW.js
+1
-0
未找到文件。
backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java
浏览文件 @
94dd8372
...
@@ -12,10 +12,7 @@ import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient;
...
@@ -12,10 +12,7 @@ import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient;
import
org.apache.jmeter.visualizers.backend.BackendListenerContext
;
import
org.apache.jmeter.visualizers.backend.BackendListenerContext
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
/**
...
@@ -72,6 +69,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
...
@@ -72,6 +69,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
sampleResults
.
forEach
(
result
->
{
sampleResults
.
forEach
(
result
->
{
String
thread
=
StringUtils
.
substringBeforeLast
(
result
.
getThreadName
(),
" "
);
String
thread
=
StringUtils
.
substringBeforeLast
(
result
.
getThreadName
(),
" "
);
String
order
=
StringUtils
.
substringAfterLast
(
result
.
getThreadName
(),
" "
);
String
scenarioName
=
StringUtils
.
substringBefore
(
thread
,
SPLIT
);
String
scenarioName
=
StringUtils
.
substringBefore
(
thread
,
SPLIT
);
String
scenarioId
=
StringUtils
.
substringAfter
(
thread
,
SPLIT
);
String
scenarioId
=
StringUtils
.
substringAfter
(
thread
,
SPLIT
);
ScenarioResult
scenarioResult
;
ScenarioResult
scenarioResult
;
...
@@ -79,6 +77,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
...
@@ -79,6 +77,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
scenarioResult
=
new
ScenarioResult
();
scenarioResult
=
new
ScenarioResult
();
scenarioResult
.
setId
(
scenarioId
);
scenarioResult
.
setId
(
scenarioId
);
scenarioResult
.
setName
(
scenarioName
);
scenarioResult
.
setName
(
scenarioName
);
scenarioResult
.
setOrder
(
StringUtils
.
substringBefore
(
order
,
"-"
));
scenarios
.
put
(
scenarioId
,
scenarioResult
);
scenarios
.
put
(
scenarioId
,
scenarioResult
);
}
else
{
}
else
{
scenarioResult
=
scenarios
.
get
(
scenarioId
);
scenarioResult
=
scenarios
.
get
(
scenarioId
);
...
@@ -103,6 +102,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
...
@@ -103,6 +102,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
scenarioResult
.
addTotalAssertions
(
requestResult
.
getTotalAssertions
());
scenarioResult
.
addTotalAssertions
(
requestResult
.
getTotalAssertions
());
});
});
testResult
.
getScenarios
().
addAll
(
scenarios
.
values
());
testResult
.
getScenarios
().
addAll
(
scenarios
.
values
());
testResult
.
getScenarios
().
sort
(
Comparator
.
comparing
(
ScenarioResult:
:
getOrder
));
apiTestService
.
changeStatus
(
id
,
APITestStatus
.
Completed
);
apiTestService
.
changeStatus
(
id
,
APITestStatus
.
Completed
);
apiReportService
.
save
(
testResult
);
apiReportService
.
save
(
testResult
);
});
});
...
...
backend/src/main/java/io/metersphere/api/jmeter/ScenarioResult.java
浏览文件 @
94dd8372
...
@@ -12,6 +12,8 @@ public class ScenarioResult {
...
@@ -12,6 +12,8 @@ public class ScenarioResult {
private
String
name
;
private
String
name
;
private
String
order
;
private
long
responseTime
;
private
long
responseTime
;
private
int
error
=
0
;
private
int
error
=
0
;
...
...
backend/src/main/java/io/metersphere/base/domain/LoadTestReport.java
浏览文件 @
94dd8372
...
@@ -18,5 +18,7 @@ public class LoadTestReport implements Serializable {
...
@@ -18,5 +18,7 @@ public class LoadTestReport implements Serializable {
private
String
status
;
private
String
status
;
private
String
description
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
\ No newline at end of file
backend/src/main/java/io/metersphere/base/domain/LoadTestReportDetail.java
浏览文件 @
94dd8372
package
io.metersphere.base.domain
;
package
io.metersphere.base.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
import
java.io.Serializable
;
import
java.io.Serializable
;
@Data
@Data
public
class
LoadTestReportDetail
implements
Serializable
{
@EqualsAndHashCode
(
callSuper
=
true
)
private
String
reportId
;
@ToString
(
callSuper
=
true
)
public
class
LoadTestReportDetail
extends
LoadTestReportDetailKey
implements
Serializable
{
private
String
content
;
private
String
content
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
backend/src/main/java/io/metersphere/base/domain/LoadTestReportDetailExample.java
浏览文件 @
94dd8372
...
@@ -173,6 +173,66 @@ public class LoadTestReportDetailExample {
...
@@ -173,6 +173,66 @@ public class LoadTestReportDetailExample {
addCriterion
(
"report_id not between"
,
value1
,
value2
,
"reportId"
);
addCriterion
(
"report_id not between"
,
value1
,
value2
,
"reportId"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
andPartIsNull
()
{
addCriterion
(
"part is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartIsNotNull
()
{
addCriterion
(
"part is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartEqualTo
(
Long
value
)
{
addCriterion
(
"part ="
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartNotEqualTo
(
Long
value
)
{
addCriterion
(
"part <>"
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartGreaterThan
(
Long
value
)
{
addCriterion
(
"part >"
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"part >="
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartLessThan
(
Long
value
)
{
addCriterion
(
"part <"
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"part <="
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartIn
(
List
<
Long
>
values
)
{
addCriterion
(
"part in"
,
values
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"part not in"
,
values
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"part between"
,
value1
,
value2
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"part not between"
,
value1
,
value2
,
"part"
);
return
(
Criteria
)
this
;
}
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
backend/src/main/java/io/metersphere/base/domain/LoadTestReport
WithBLOBs
.java
→
backend/src/main/java/io/metersphere/base/domain/LoadTestReport
DetailKey
.java
浏览文件 @
94dd8372
package
io.metersphere.base.domain
;
package
io.metersphere.base.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
import
java.io.Serializable
;
import
java.io.Serializable
;
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
LoadTestReportDetailKey
implements
Serializable
{
@ToString
(
callSuper
=
true
)
private
String
reportId
;
public
class
LoadTestReportWithBLOBs
extends
LoadTestReport
implements
Serializable
{
private
String
description
;
private
String
conten
t
;
private
Long
par
t
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
}
}
\ No newline at end of file
backend/src/main/java/io/metersphere/base/domain/LoadTestReportLog.java
浏览文件 @
94dd8372
...
@@ -12,6 +12,8 @@ public class LoadTestReportLog implements Serializable {
...
@@ -12,6 +12,8 @@ public class LoadTestReportLog implements Serializable {
private
String
resourceId
;
private
String
resourceId
;
private
Long
part
;
private
String
content
;
private
String
content
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
backend/src/main/java/io/metersphere/base/domain/LoadTestReportLogExample.java
浏览文件 @
94dd8372
...
@@ -313,6 +313,66 @@ public class LoadTestReportLogExample {
...
@@ -313,6 +313,66 @@ public class LoadTestReportLogExample {
addCriterion
(
"resource_id not between"
,
value1
,
value2
,
"resourceId"
);
addCriterion
(
"resource_id not between"
,
value1
,
value2
,
"resourceId"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
andPartIsNull
()
{
addCriterion
(
"part is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartIsNotNull
()
{
addCriterion
(
"part is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartEqualTo
(
Long
value
)
{
addCriterion
(
"part ="
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartNotEqualTo
(
Long
value
)
{
addCriterion
(
"part <>"
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartGreaterThan
(
Long
value
)
{
addCriterion
(
"part >"
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"part >="
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartLessThan
(
Long
value
)
{
addCriterion
(
"part <"
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"part <="
,
value
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartIn
(
List
<
Long
>
values
)
{
addCriterion
(
"part in"
,
values
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"part not in"
,
values
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"part between"
,
value1
,
value2
,
"part"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPartNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"part not between"
,
value1
,
value2
,
"part"
);
return
(
Criteria
)
this
;
}
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportDetailMapper.java
浏览文件 @
94dd8372
...
@@ -2,6 +2,7 @@ package io.metersphere.base.mapper;
...
@@ -2,6 +2,7 @@ package io.metersphere.base.mapper;
import
io.metersphere.base.domain.LoadTestReportDetail
;
import
io.metersphere.base.domain.LoadTestReportDetail
;
import
io.metersphere.base.domain.LoadTestReportDetailExample
;
import
io.metersphere.base.domain.LoadTestReportDetailExample
;
import
io.metersphere.base.domain.LoadTestReportDetailKey
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -11,7 +12,7 @@ public interface LoadTestReportDetailMapper {
...
@@ -11,7 +12,7 @@ public interface LoadTestReportDetailMapper {
int
deleteByExample
(
LoadTestReportDetailExample
example
);
int
deleteByExample
(
LoadTestReportDetailExample
example
);
int
deleteByPrimaryKey
(
String
reportId
);
int
deleteByPrimaryKey
(
LoadTestReportDetailKey
key
);
int
insert
(
LoadTestReportDetail
record
);
int
insert
(
LoadTestReportDetail
record
);
...
@@ -21,7 +22,7 @@ public interface LoadTestReportDetailMapper {
...
@@ -21,7 +22,7 @@ public interface LoadTestReportDetailMapper {
List
<
LoadTestReportDetail
>
selectByExample
(
LoadTestReportDetailExample
example
);
List
<
LoadTestReportDetail
>
selectByExample
(
LoadTestReportDetailExample
example
);
LoadTestReportDetail
selectByPrimaryKey
(
String
reportId
);
LoadTestReportDetail
selectByPrimaryKey
(
LoadTestReportDetailKey
key
);
int
updateByExampleSelective
(
@Param
(
"record"
)
LoadTestReportDetail
record
,
@Param
(
"example"
)
LoadTestReportDetailExample
example
);
int
updateByExampleSelective
(
@Param
(
"record"
)
LoadTestReportDetail
record
,
@Param
(
"example"
)
LoadTestReportDetailExample
example
);
...
...
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportDetailMapper.xml
浏览文件 @
94dd8372
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
<mapper
namespace=
"io.metersphere.base.mapper.LoadTestReportDetailMapper"
>
<mapper
namespace=
"io.metersphere.base.mapper.LoadTestReportDetailMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.metersphere.base.domain.LoadTestReportDetail"
>
<resultMap
id=
"BaseResultMap"
type=
"io.metersphere.base.domain.LoadTestReportDetail"
>
<id
column=
"report_id"
jdbcType=
"VARCHAR"
property=
"reportId"
/>
<id
column=
"report_id"
jdbcType=
"VARCHAR"
property=
"reportId"
/>
<id
column=
"part"
jdbcType=
"BIGINT"
property=
"part"
/>
</resultMap>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.metersphere.base.domain.LoadTestReportDetail"
>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.metersphere.base.domain.LoadTestReportDetail"
>
<result
column=
"content"
jdbcType=
"LONGVARCHAR"
property=
"content"
/>
<result
column=
"content"
jdbcType=
"LONGVARCHAR"
property=
"content"
/>
...
@@ -66,7 +67,8 @@
...
@@ -66,7 +67,8 @@
</where>
</where>
</sql>
</sql>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
report_id
report_id,
part
</sql>
</sql>
<sql
id=
"Blob_Column_List"
>
<sql
id=
"Blob_Column_List"
>
content
content
...
@@ -101,18 +103,20 @@
...
@@ -101,18 +103,20 @@
order by ${orderByClause}
order by ${orderByClause}
</if>
</if>
</select>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.String"
resultMap=
"ResultMapWithBLOBs"
>
<select
id=
"selectByPrimaryKey"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetailKey"
resultMap=
"ResultMapWithBLOBs"
>
select
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
,
,
<include
refid=
"Blob_Column_List"
/>
<include
refid=
"Blob_Column_List"
/>
from load_test_report_detail
FROM load_test_report_detail
where report_id = #{reportId,jdbcType=VARCHAR}
WHERE report_id = #{reportId,jdbcType=VARCHAR}
</select>
AND part = #{part,jdbcType=BIGINT}
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
</select>
delete from load_test_report_detail
<delete
id=
"deleteByPrimaryKey"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetailKey"
>
where report_id = #{reportId,jdbcType=VARCHAR}
DELETE FROM load_test_report_detail
</delete>
WHERE report_id = #{reportId,jdbcType=VARCHAR}
AND part = #{part,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetailExample"
>
<delete
id=
"deleteByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetailExample"
>
delete from load_test_report_detail
delete from load_test_report_detail
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
...
@@ -120,27 +124,35 @@
...
@@ -120,27 +124,35 @@
</if>
</if>
</delete>
</delete>
<insert
id=
"insert"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetail"
>
<insert
id=
"insert"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetail"
>
insert into load_test_report_detail (report_id, content)
insert into load_test_report_detail (report_id, part, content
values (#{reportId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
)
values (#{reportId,jdbcType=VARCHAR}, #{part,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}
)
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetail"
>
<insert
id=
"insertSelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetail"
>
insert into load_test_report_detail
insert into load_test_report_detail
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"reportId != null"
>
<if
test=
"reportId != null"
>
report_id,
report_id,
</if>
</if>
<if
test=
"content != null"
>
<if
test=
"part != null"
>
content,
part,
</if>
</if>
</trim>
<if
test=
"content != null"
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
content,
<if
test=
"reportId != null"
>
</if>
#{reportId,jdbcType=VARCHAR},
</trim>
</if>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"content != null"
>
<if
test=
"reportId != null"
>
#{content,jdbcType=LONGVARCHAR},
#{reportId,jdbcType=VARCHAR},
</if>
</if>
</trim>
<if
test=
"part != null"
>
#{part,jdbcType=BIGINT},
</if>
<if
test=
"content != null"
>
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
</insert>
<select
id=
"countByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetailExample"
resultType=
"java.lang.Long"
>
<select
id=
"countByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetailExample"
resultType=
"java.lang.Long"
>
select count(*) from load_test_report_detail
select count(*) from load_test_report_detail
...
@@ -150,30 +162,35 @@
...
@@ -150,30 +162,35 @@
</select>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update load_test_report_detail
update load_test_report_detail
<set>
<set>
<if
test=
"record.reportId != null"
>
<if
test=
"record.reportId != null"
>
report_id = #{record.reportId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"record.content != null"
>
<if
test=
"record.part != null"
>
content = #{record.content,jdbcType=LONGVARCHAR},
part = #{record.part,jdbcType=BIGINT},
</if>
</if>
</set>
<if
test=
"record.content != null"
>
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
update load_test_report_detail
update load_test_report_detail
set report_id = #{record.reportId,jdbcType=VARCHAR},
set report_id = #{record.reportId,jdbcType=VARCHAR},
part = #{record.part,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR}
content = #{record.content,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
<update
id=
"updateByExample"
parameterType=
"map"
>
update load_test_report_detail
update load_test_report_detail
set report_id = #{record.reportId,jdbcType=VARCHAR}
set report_id = #{record.reportId,jdbcType=VARCHAR},
<if
test=
"_parameter != null"
>
part = #{record.part,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
...
@@ -184,11 +201,13 @@
...
@@ -184,11 +201,13 @@
content = #{content,jdbcType=LONGVARCHAR},
content = #{content,jdbcType=LONGVARCHAR},
</if>
</if>
</set>
</set>
where report_id = #{reportId,jdbcType=VARCHAR}
where report_id = #{reportId,jdbcType=VARCHAR}
and part = #{part,jdbcType=BIGINT}
</update>
</update>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetail"
>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReportDetail"
>
update load_test_report_detail
update load_test_report_detail
set content = #{content,jdbcType=LONGVARCHAR}
set content = #{content,jdbcType=LONGVARCHAR}
where report_id = #{reportId,jdbcType=VARCHAR}
where report_id = #{reportId,jdbcType=VARCHAR}
and part = #{part,jdbcType=BIGINT}
</update>
</update>
</mapper>
</mapper>
\ No newline at end of file
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportLogMapper.xml
浏览文件 @
94dd8372
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<id
column=
"id"
jdbcType=
"VARCHAR"
property=
"id"
/>
<id
column=
"id"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"report_id"
jdbcType=
"VARCHAR"
property=
"reportId"
/>
<result
column=
"report_id"
jdbcType=
"VARCHAR"
property=
"reportId"
/>
<result
column=
"resource_id"
jdbcType=
"VARCHAR"
property=
"resourceId"
/>
<result
column=
"resource_id"
jdbcType=
"VARCHAR"
property=
"resourceId"
/>
<result
column=
"part"
jdbcType=
"BIGINT"
property=
"part"
/>
</resultMap>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.metersphere.base.domain.LoadTestReportLog"
>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.metersphere.base.domain.LoadTestReportLog"
>
<result
column=
"content"
jdbcType=
"LONGVARCHAR"
property=
"content"
/>
<result
column=
"content"
jdbcType=
"LONGVARCHAR"
property=
"content"
/>
...
@@ -68,7 +69,10 @@
...
@@ -68,7 +69,10 @@
</where>
</where>
</sql>
</sql>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, report_id, resource_id
id,
report_id,
resource_id,
part
</sql>
</sql>
<sql
id=
"Blob_Column_List"
>
<sql
id=
"Blob_Column_List"
>
content
content
...
@@ -122,41 +126,47 @@
...
@@ -122,41 +126,47 @@
</if>
</if>
</delete>
</delete>
<insert
id=
"insert"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
<insert
id=
"insert"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
insert into load_test_report_log (id, report_id, resource_id,
insert into load_test_report_log (id, report_id, resource_id,
content)
part,
content)
values (#{id,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{content,jdbcType=LONGVARCHAR})
#{
part,jdbcType=BIGINT}, #{
content,jdbcType=LONGVARCHAR})
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
<insert
id=
"insertSelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
insert into load_test_report_log
insert into load_test_report_log
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
id,
id,
</if>
</if>
<if
test=
"reportId != null"
>
<if
test=
"reportId != null"
>
report_id,
report_id,
</if>
</if>
<if
test=
"resourceId != null"
>
<if
test=
"resourceId != null"
>
resource_id,
resource_id,
</if>
</if>
<if
test=
"content != null"
>
<if
test=
"part != null"
>
content,
part,
</if>
</if>
</trim>
<if
test=
"content != null"
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
content,
<if
test=
"id != null"
>
</if>
#{id,jdbcType=VARCHAR},
</trim>
</if>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"reportId != null"
>
<if
test=
"id != null"
>
#{reportId,jdbcType=VARCHAR},
#{id,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"resourceId != null"
>
<if
test=
"reportId != null"
>
#{resourceId,jdbcType=VARCHAR},
#{reportId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"content != null"
>
<if
test=
"resourceId != null"
>
#{content,jdbcType=LONGVARCHAR},
#{resourceId,jdbcType=VARCHAR},
</if>
</if>
</trim>
<if
test=
"part != null"
>
#{part,jdbcType=BIGINT},
</if>
<if
test=
"content != null"
>
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
</insert>
<select
id=
"countByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportLogExample"
resultType=
"java.lang.Long"
>
<select
id=
"countByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportLogExample"
resultType=
"java.lang.Long"
>
select count(*) from load_test_report_log
select count(*) from load_test_report_log
...
@@ -166,69 +176,79 @@
...
@@ -166,69 +176,79 @@
</select>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update load_test_report_log
update load_test_report_log
<set>
<set>
<if
test=
"record.id != null"
>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=VARCHAR},
id = #{record.id,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"record.reportId != null"
>
<if
test=
"record.reportId != null"
>
report_id = #{record.reportId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"record.resourceId != null"
>
<if
test=
"record.resourceId != null"
>
resource_id = #{record.resourceId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"record.content != null"
>
<if
test=
"record.part != null"
>
content = #{record.content,jdbcType=LONGVARCHAR},
part = #{record.part,jdbcType=BIGINT},
</if>
</if>
</set>
<if
test=
"record.content != null"
>
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
update load_test_report_log
update load_test_report_log
set id = #{record.id,jdbcType=VARCHAR},
set id = #{record.id,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
part = #{record.part,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR}
content = #{record.content,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
<update
id=
"updateByExample"
parameterType=
"map"
>
update load_test_report_log
update load_test_report_log
set id = #{record.id,jdbcType=VARCHAR},
set id = #{record.id,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR}
resource_id = #{record.resourceId,jdbcType=VARCHAR},
<if
test=
"_parameter != null"
>
part = #{record.part,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
update load_test_report_log
update load_test_report_log
<set>
<set>
<if
test=
"reportId != null"
>
<if
test=
"reportId != null"
>
report_id = #{reportId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"resourceId != null"
>
<if
test=
"resourceId != null"
>
resource_id = #{resourceId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"content != null"
>
<if
test=
"part != null"
>
content = #{content,jdbcType=LONGVARCHAR},
part = #{part,jdbcType=BIGINT},
</if>
</if>
</set>
<if
test=
"content != null"
>
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</update>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
update load_test_report_log
update load_test_report_log
set report_id = #{reportId,jdbcType=VARCHAR},
set report_id = #{reportId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR},
part = #{part,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARCHAR}
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.metersphere.base.domain.LoadTestReportLog"
>
update load_test_report_log
update load_test_report_log
set report_id = #{reportId,jdbcType=VARCHAR},
set report_id = #{reportId,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR}
resource_id = #{resourceId,jdbcType=VARCHAR},
where id = #{id,jdbcType=VARCHAR}
part = #{part,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</update>
</mapper>
</mapper>
\ No newline at end of file
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.java
浏览文件 @
94dd8372
...
@@ -2,7 +2,6 @@ package io.metersphere.base.mapper;
...
@@ -2,7 +2,6 @@ package io.metersphere.base.mapper;
import
io.metersphere.base.domain.LoadTestReport
;
import
io.metersphere.base.domain.LoadTestReport
;
import
io.metersphere.base.domain.LoadTestReportExample
;
import
io.metersphere.base.domain.LoadTestReportExample
;
import
io.metersphere.base.domain.LoadTestReportWithBLOBs
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -14,25 +13,25 @@ public interface LoadTestReportMapper {
...
@@ -14,25 +13,25 @@ public interface LoadTestReportMapper {
int
deleteByPrimaryKey
(
String
id
);
int
deleteByPrimaryKey
(
String
id
);
int
insert
(
LoadTestReport
WithBLOBs
record
);
int
insert
(
LoadTestReport
record
);
int
insertSelective
(
LoadTestReport
WithBLOBs
record
);
int
insertSelective
(
LoadTestReport
record
);
List
<
LoadTestReport
WithBLOBs
>
selectByExampleWithBLOBs
(
LoadTestReportExample
example
);
List
<
LoadTestReport
>
selectByExampleWithBLOBs
(
LoadTestReportExample
example
);
List
<
LoadTestReport
>
selectByExample
(
LoadTestReportExample
example
);
List
<
LoadTestReport
>
selectByExample
(
LoadTestReportExample
example
);
LoadTestReport
WithBLOBs
selectByPrimaryKey
(
String
id
);
LoadTestReport
selectByPrimaryKey
(
String
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
LoadTestReport
WithBLOBs
record
,
@Param
(
"example"
)
LoadTestReportExample
example
);
int
updateByExampleSelective
(
@Param
(
"record"
)
LoadTestReport
record
,
@Param
(
"example"
)
LoadTestReportExample
example
);
int
updateByExampleWithBLOBs
(
@Param
(
"record"
)
LoadTestReport
WithBLOBs
record
,
@Param
(
"example"
)
LoadTestReportExample
example
);
int
updateByExampleWithBLOBs
(
@Param
(
"record"
)
LoadTestReport
record
,
@Param
(
"example"
)
LoadTestReportExample
example
);
int
updateByExample
(
@Param
(
"record"
)
LoadTestReport
record
,
@Param
(
"example"
)
LoadTestReportExample
example
);
int
updateByExample
(
@Param
(
"record"
)
LoadTestReport
record
,
@Param
(
"example"
)
LoadTestReportExample
example
);
int
updateByPrimaryKeySelective
(
LoadTestReport
WithBLOBs
record
);
int
updateByPrimaryKeySelective
(
LoadTestReport
record
);
int
updateByPrimaryKeyWithBLOBs
(
LoadTestReport
WithBLOBs
record
);
int
updateByPrimaryKeyWithBLOBs
(
LoadTestReport
record
);
int
updateByPrimaryKey
(
LoadTestReport
record
);
int
updateByPrimaryKey
(
LoadTestReport
record
);
}
}
\ No newline at end of file
backend/src/main/java/io/metersphere/base/mapper/LoadTestReportMapper.xml
浏览文件 @
94dd8372
...
@@ -9,9 +9,8 @@
...
@@ -9,9 +9,8 @@
<result
column=
"update_time"
jdbcType=
"BIGINT"
property=
"updateTime"
/>
<result
column=
"update_time"
jdbcType=
"BIGINT"
property=
"updateTime"
/>
<result
column=
"status"
jdbcType=
"VARCHAR"
property=
"status"
/>
<result
column=
"status"
jdbcType=
"VARCHAR"
property=
"status"
/>
</resultMap>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.metersphere.base.domain.LoadTestReportWithBLOBs"
>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.metersphere.base.domain.LoadTestReport"
>
<result
column=
"description"
jdbcType=
"LONGVARCHAR"
property=
"description"
/>
<result
column=
"description"
jdbcType=
"LONGVARCHAR"
property=
"description"
/>
<result
column=
"content"
jdbcType=
"LONGVARCHAR"
property=
"content"
/>
</resultMap>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<sql
id=
"Example_Where_Clause"
>
<where>
<where>
...
@@ -75,7 +74,7 @@
...
@@ -75,7 +74,7 @@
id, test_id, name, create_time, update_time, status
id, test_id, name, create_time, update_time, status
</sql>
</sql>
<sql
id=
"Blob_Column_List"
>
<sql
id=
"Blob_Column_List"
>
description, content
description
</sql>
</sql>
<select
id=
"selectByExampleWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReportExample"
resultMap=
"ResultMapWithBLOBs"
>
<select
id=
"selectByExampleWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReportExample"
resultMap=
"ResultMapWithBLOBs"
>
select
select
...
@@ -125,25 +124,25 @@
...
@@ -125,25 +124,25 @@
<include
refid=
"Example_Where_Clause"
/>
<include
refid=
"Example_Where_Clause"
/>
</if>
</if>
</delete>
</delete>
<insert
id=
"insert"
parameterType=
"io.metersphere.base.domain.LoadTestReportWithBLOBs
"
>
<insert
id=
"insert"
parameterType=
"io.metersphere.base.domain.LoadTestReport
"
>
insert into load_test_report (id, test_id, name,
INSERT INTO load_test_report (id, test_id, name,
create_time, update_time, status,
create_time, update_time, status,
description, content
)
description
)
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
VALUES (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
#{description,jdbcType=LONGVARCHAR}, #{content
,jdbcType=LONGVARCHAR})
#{description
,jdbcType=LONGVARCHAR})
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportWithBLOBs
"
>
<insert
id=
"insertSelective"
parameterType=
"io.metersphere.base.domain.LoadTestReport
"
>
insert into load_test_report
insert into load_test_report
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
id,
id,
</if>
</if>
<if
test=
"testId != null"
>
<if
test=
"testId != null"
>
test_id,
test_id,
</if>
</if>
<if
test=
"name != null"
>
<if
test=
"name != null"
>
name,
name,
</if>
</if>
<if
test=
"createTime != null"
>
<if
test=
"createTime != null"
>
create_time,
create_time,
...
@@ -157,9 +156,6 @@
...
@@ -157,9 +156,6 @@
<if
test=
"description != null"
>
<if
test=
"description != null"
>
description,
description,
</if>
</if>
<if
test=
"content != null"
>
content,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
...
@@ -183,9 +179,6 @@
...
@@ -183,9 +179,6 @@
<if
test=
"description != null"
>
<if
test=
"description != null"
>
#{description,jdbcType=LONGVARCHAR},
#{description,jdbcType=LONGVARCHAR},
</if>
</if>
<if
test=
"content != null"
>
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</trim>
</insert>
</insert>
<select
id=
"countByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportExample"
resultType=
"java.lang.Long"
>
<select
id=
"countByExample"
parameterType=
"io.metersphere.base.domain.LoadTestReportExample"
resultType=
"java.lang.Long"
>
...
@@ -218,25 +211,21 @@
...
@@ -218,25 +211,21 @@
<if
test=
"record.description != null"
>
<if
test=
"record.description != null"
>
description = #{record.description,jdbcType=LONGVARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
</if>
</if>
<if
test=
"record.content != null"
>
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
</set>
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
update load_test_report
update load_test_report
set id = #{record.id,jdbcType=VARCHAR},
set id = #{record.id,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
status = #{record.status,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR}
content = #{record.content,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
...
@@ -252,17 +241,17 @@
...
@@ -252,17 +241,17 @@
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
</update>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.metersphere.base.domain.LoadTestReportWithBLOBs
"
>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.metersphere.base.domain.LoadTestReport
"
>
update load_test_report
update load_test_report
<set>
<set>
<if
test=
"testId != null"
>
<if
test=
"testId != null"
>
test_id = #{testId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"name != null"
>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
</if>
</if>
<if
test=
"createTime != null"
>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
</if>
</if>
<if
test=
"updateTime != null"
>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
...
@@ -273,23 +262,19 @@
...
@@ -273,23 +262,19 @@
<if
test=
"description != null"
>
<if
test=
"description != null"
>
description = #{description,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
</if>
</if>
<if
test=
"content != null"
>
content = #{content,jdbcType=LONGVARCHAR},
</if>
</set>
</set>
where id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</update>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReportWithBLOBs"
>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"io.metersphere.base.domain.LoadTestReport"
>
update load_test_report
UPDATE load_test_report
set test_id = #{testId,jdbcType=VARCHAR},
SET test_id = #{testId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
status = #{status,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR}
content = #{content,jdbcType=LONGVARCHAR}
WHERE id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.metersphere.base.domain.LoadTestReport"
>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.metersphere.base.domain.LoadTestReport"
>
update load_test_report
update load_test_report
set test_id = #{testId,jdbcType=VARCHAR},
set test_id = #{testId,jdbcType=VARCHAR},
...
...
backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.java
浏览文件 @
94dd8372
...
@@ -14,8 +14,6 @@ public interface ExtLoadTestReportMapper {
...
@@ -14,8 +14,6 @@ public interface ExtLoadTestReportMapper {
ReportDTO
getReportTestAndProInfo
(
@Param
(
"id"
)
String
id
);
ReportDTO
getReportTestAndProInfo
(
@Param
(
"id"
)
String
id
);
int
appendLine
(
@Param
(
"testId"
)
String
id
,
@Param
(
"line"
)
String
line
);
LoadTestReport
selectByPrimaryKey
(
String
id
);
LoadTestReport
selectByPrimaryKey
(
String
id
);
List
<
DashboardTestDTO
>
selectDashboardTests
(
@Param
(
"workspaceId"
)
String
workspaceId
,
@Param
(
"startTimestamp"
)
long
startTimestamp
);
List
<
DashboardTestDTO
>
selectDashboardTests
(
@Param
(
"workspaceId"
)
String
workspaceId
,
@Param
(
"startTimestamp"
)
long
startTimestamp
);
...
...
backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml
浏览文件 @
94dd8372
...
@@ -41,12 +41,6 @@
...
@@ -41,12 +41,6 @@
where ltr.id = #{id}
where ltr.id = #{id}
</select>
</select>
<update
id=
"appendLine"
>
UPDATE load_test_report
SET content = concat(content, #{line})
WHERE id = #{testId}
</update>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
SELECT
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
...
...
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java
浏览文件 @
94dd8372
package
io.metersphere.base.mapper.ext
;
package
io.metersphere.base.mapper.ext
;
import
io.metersphere.base.domain.Workspace
;
import
io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest
;
import
io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest
;
import
io.metersphere.track.dto.TestCaseReportStatusResultDTO
;
import
io.metersphere.track.dto.TestCaseReportStatusResultDTO
;
import
io.metersphere.track.dto.TestPlanCaseDTO
;
import
io.metersphere.track.dto.TestPlanCaseDTO
;
...
@@ -15,7 +16,7 @@ public interface ExtTestPlanTestCaseMapper {
...
@@ -15,7 +16,7 @@ public interface ExtTestPlanTestCaseMapper {
List
<
TestPlanCaseDTO
>
list
(
@Param
(
"request"
)
QueryTestPlanCaseRequest
request
);
List
<
TestPlanCaseDTO
>
list
(
@Param
(
"request"
)
QueryTestPlanCaseRequest
request
);
List
<
String
>
findRelateTestPlanId
(
String
user
Id
);
List
<
String
>
findRelateTestPlanId
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"workspaceId"
)
String
workspace
Id
);
List
<
TestPlanCaseDTO
>
getRecentTestedTestCase
(
@Param
(
"request"
)
QueryTestPlanCaseRequest
request
);
List
<
TestPlanCaseDTO
>
getRecentTestedTestCase
(
@Param
(
"request"
)
QueryTestPlanCaseRequest
request
);
...
...
backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
浏览文件 @
94dd8372
...
@@ -62,7 +62,11 @@
...
@@ -62,7 +62,11 @@
</select>
</select>
<select
id=
"findRelateTestPlanId"
resultType=
"java.lang.String"
>
<select
id=
"findRelateTestPlanId"
resultType=
"java.lang.String"
>
select distinct plan_id from test_plan_test_case where executor = #{userId}
select distinct plan_id from test_plan_test_case
inner join test_plan
on test_plan_test_case.plan_id = test_plan.id
where test_plan_test_case.executor = #{userId}
and test_plan.workspace_id = #{workspaceId}
</select>
</select>
<select
id=
"getRecentTestedTestCase"
resultType=
"io.metersphere.track.dto.TestPlanCaseDTO"
>
<select
id=
"getRecentTestedTestCase"
resultType=
"io.metersphere.track.dto.TestPlanCaseDTO"
>
select test_plan_test_case.*, test_case.*
select test_plan_test_case.*, test_case.*
...
...
backend/src/main/java/io/metersphere/controller/RoleController.java
浏览文件 @
94dd8372
...
@@ -22,4 +22,9 @@ public class RoleController {
...
@@ -22,4 +22,9 @@ public class RoleController {
return
roleService
.
getRoleList
(
sign
);
return
roleService
.
getRoleList
(
sign
);
}
}
@GetMapping
(
"/all"
)
public
List
<
Role
>
getAllRole
()
{
return
roleService
.
getAllRole
();
}
}
}
backend/src/main/java/io/metersphere/controller/UserController.java
浏览文件 @
94dd8372
...
@@ -9,8 +9,8 @@ import io.metersphere.commons.user.SessionUser;
...
@@ -9,8 +9,8 @@ import io.metersphere.commons.user.SessionUser;
import
io.metersphere.commons.utils.PageUtils
;
import
io.metersphere.commons.utils.PageUtils
;
import
io.metersphere.commons.utils.Pager
;
import
io.metersphere.commons.utils.Pager
;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.controller.request.UserRequest
;
import
io.metersphere.controller.request.member.AddMemberRequest
;
import
io.metersphere.controller.request.member.AddMemberRequest
;
import
io.metersphere.controller.request.member.UserRequest
;
import
io.metersphere.controller.request.member.EditPassWordRequest
;
import
io.metersphere.controller.request.member.EditPassWordRequest
;
import
io.metersphere.controller.request.member.QueryMemberRequest
;
import
io.metersphere.controller.request.member.QueryMemberRequest
;
import
io.metersphere.controller.request.organization.AddOrgMemberRequest
;
import
io.metersphere.controller.request.organization.AddOrgMemberRequest
;
...
@@ -38,16 +38,15 @@ public class UserController {
...
@@ -38,16 +38,15 @@ public class UserController {
@Resource
@Resource
private
WorkspaceService
workspaceService
;
private
WorkspaceService
workspaceService
;
// admin api
@PostMapping
(
"/special/add"
)
@PostMapping
(
"/special/add"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
UserDTO
insertUser
(
@RequestBody
User
user
)
{
public
UserDTO
insertUser
(
@RequestBody
User
Request
user
)
{
return
userService
.
insert
(
user
);
return
userService
.
insert
(
user
);
}
}
@PostMapping
(
"/special/list/{goPage}/{pageSize}"
)
@PostMapping
(
"/special/list/{goPage}/{pageSize}"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
Pager
<
List
<
User
>>
getUserList
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
UserRequest
request
)
{
public
Pager
<
List
<
User
>>
getUserList
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
io
.
metersphere
.
controller
.
request
.
UserRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
return
PageUtils
.
setPageInfo
(
page
,
userService
.
getUserListWithRequest
(
request
));
return
PageUtils
.
setPageInfo
(
page
,
userService
.
getUserListWithRequest
(
request
));
}
}
...
@@ -66,8 +65,8 @@ public class UserController {
...
@@ -66,8 +65,8 @@ public class UserController {
@PostMapping
(
"/special/update"
)
@PostMapping
(
"/special/update"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
void
updateUser
(
@RequestBody
User
user
)
{
public
void
updateUser
(
@RequestBody
User
Request
user
)
{
userService
.
updateUser
(
user
);
userService
.
updateUser
Role
(
user
);
}
}
@PostMapping
(
"/special/ws/member/list/{goPage}/{pageSize}"
)
@PostMapping
(
"/special/ws/member/list/{goPage}/{pageSize}"
)
...
@@ -119,7 +118,6 @@ public class UserController {
...
@@ -119,7 +118,6 @@ public class UserController {
public
List
<
User
>
getOrgMemberListByAdmin
(
@RequestBody
QueryOrgMemberRequest
request
)
{
public
List
<
User
>
getOrgMemberListByAdmin
(
@RequestBody
QueryOrgMemberRequest
request
)
{
return
userService
.
getOrgMemberList
(
request
);
return
userService
.
getOrgMemberList
(
request
);
}
}
// admin api
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
...
...
backend/src/main/java/io/metersphere/controller/UserRoleController.java
浏览文件 @
94dd8372
...
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@RequestMapping
(
"userrole"
)
@RequestMapping
(
"userrole"
)
@RestController
@RestController
...
@@ -20,14 +21,20 @@ public class UserRoleController {
...
@@ -20,14 +21,20 @@ public class UserRoleController {
private
UserRoleService
userRoleService
;
private
UserRoleService
userRoleService
;
@GetMapping
(
"/list/org/{orgId}/{userId}"
)
@GetMapping
(
"/list/org/{orgId}/{userId}"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
public
List
<
Role
>
getOrganizationMemberRoles
(
@PathVariable
String
orgId
,
@PathVariable
String
userId
)
{
public
List
<
Role
>
getOrganizationMemberRoles
(
@PathVariable
String
orgId
,
@PathVariable
String
userId
)
{
return
userRoleService
.
getOrganizationMemberRoles
(
orgId
,
userId
);
return
userRoleService
.
getOrganizationMemberRoles
(
orgId
,
userId
);
}
}
@GetMapping
(
"/list/ws/{workspaceId}/{userId}"
)
@GetMapping
(
"/list/ws/{workspaceId}/{userId}"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
public
List
<
Role
>
getWorkspaceMemberRoles
(
@PathVariable
String
workspaceId
,
@PathVariable
String
userId
)
{
public
List
<
Role
>
getWorkspaceMemberRoles
(
@PathVariable
String
workspaceId
,
@PathVariable
String
userId
)
{
return
userRoleService
.
getWorkspaceMemberRoles
(
workspaceId
,
userId
);
return
userRoleService
.
getWorkspaceMemberRoles
(
workspaceId
,
userId
);
}
}
@GetMapping
(
"/all/{userId}"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
List
<
Map
<
String
,
Object
>>
getUserRole
(
@PathVariable
(
"userId"
)
String
userId
)
{
return
userRoleService
.
getUserRole
(
userId
);
}
}
}
backend/src/main/java/io/metersphere/controller/WorkspaceController.java
浏览文件 @
94dd8372
...
@@ -38,6 +38,11 @@ public class WorkspaceController {
...
@@ -38,6 +38,11 @@ public class WorkspaceController {
return
workspaceService
.
saveWorkspace
(
workspace
);
return
workspaceService
.
saveWorkspace
(
workspace
);
}
}
@GetMapping
(
"/list"
)
public
List
<
Workspace
>
getWorkspaceList
()
{
return
workspaceService
.
getWorkspaceList
(
new
WorkspaceRequest
());
}
@PostMapping
(
"special/add"
)
@PostMapping
(
"special/add"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
void
addWorkspaceByAdmin
(
@RequestBody
Workspace
workspace
)
{
public
void
addWorkspaceByAdmin
(
@RequestBody
Workspace
workspace
)
{
...
...
backend/src/main/java/io/metersphere/controller/request/member/UserRequest.java
0 → 100644
浏览文件 @
94dd8372
package
io.metersphere.controller.request.member
;
import
io.metersphere.base.domain.User
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@Getter
@Setter
public
class
UserRequest
extends
User
{
private
List
<
Map
<
String
,
Object
>>
roles
=
new
ArrayList
<>();
}
backend/src/main/java/io/metersphere/dto/LogDetailDTO.java
浏览文件 @
94dd8372
...
@@ -6,7 +6,7 @@ import lombok.Setter;
...
@@ -6,7 +6,7 @@ import lombok.Setter;
@Getter
@Getter
@Setter
@Setter
public
class
LogDetailDTO
{
public
class
LogDetailDTO
{
private
String
i
d
;
private
String
resourceI
d
;
private
String
resourceName
;
private
String
resourceName
;
private
String
content
;
private
String
content
;
}
}
backend/src/main/java/io/metersphere/excel/listener/EasyExcelListener.java
浏览文件 @
94dd8372
...
@@ -32,8 +32,11 @@ public abstract class EasyExcelListener <T> extends AnalysisEventListener<T> {
...
@@ -32,8 +32,11 @@ public abstract class EasyExcelListener <T> extends AnalysisEventListener<T> {
public
EasyExcelListener
(){
public
EasyExcelListener
(){
Type
type
=
getClass
().
getGenericSuperclass
();
Type
type
=
getClass
().
getGenericSuperclass
();
this
.
clazz
=
(
Class
<
T
>)
((
ParameterizedType
)
type
).
getActualTypeArguments
()[
0
];
this
.
clazz
=
(
Class
<
T
>)
((
ParameterizedType
)
type
).
getActualTypeArguments
()[
0
];
this
.
easyExcelI18nTranslator
=
new
EasyExcelI18nTranslator
(
this
.
clazz
);
//防止多线程修改运行时类注解后,saveOriginalExcelProperty保存的是修改后的值
this
.
easyExcelI18nTranslator
.
translateExcelProperty
();
synchronized
(
EasyExcelI18nTranslator
.
class
)
{
this
.
easyExcelI18nTranslator
=
new
EasyExcelI18nTranslator
(
this
.
clazz
);
this
.
easyExcelI18nTranslator
.
translateExcelProperty
();
}
}
}
/**
/**
...
...
backend/src/main/java/io/metersphere/excel/utils/EasyExcelExporter.java
浏览文件 @
94dd8372
...
@@ -24,17 +24,24 @@ public class EasyExcelExporter {
...
@@ -24,17 +24,24 @@ public class EasyExcelExporter {
EasyExcelI18nTranslator
easyExcelI18nTranslator
;
EasyExcelI18nTranslator
easyExcelI18nTranslator
;
public
EasyExcelExporter
()
{
private
Class
clazz
;
easyExcelI18nTranslator
=
new
EasyExcelI18nTranslator
(
TestCaseExcelData
.
class
);
easyExcelI18nTranslator
.
translateExcelProperty
();
public
EasyExcelExporter
(
Class
clazz
)
{
this
.
clazz
=
clazz
;
//防止多线程修改运行时类注解后,saveOriginalExcelProperty保存的是修改后的值
synchronized
(
EasyExcelI18nTranslator
.
class
)
{
easyExcelI18nTranslator
=
new
EasyExcelI18nTranslator
(
clazz
);
easyExcelI18nTranslator
.
translateExcelProperty
();
}
}
}
public
void
export
(
HttpServletResponse
response
,
Class
clazz
,
List
data
,
String
fileName
,
String
sheetName
)
{
public
void
export
(
HttpServletResponse
response
,
List
data
,
String
fileName
,
String
sheetName
)
{
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
try
{
try
{
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
)
+
".xlsx"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
)
+
".xlsx"
);
EasyExcel
.
write
(
response
.
getOutputStream
(),
clazz
).
sheet
(
sheetName
).
doWrite
(
data
);
EasyExcel
.
write
(
response
.
getOutputStream
(),
this
.
clazz
).
sheet
(
sheetName
).
doWrite
(
data
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
LogUtil
.
error
(
e
.
getMessage
(),
e
);
LogUtil
.
error
(
e
.
getMessage
(),
e
);
throw
new
ExcelException
(
"Utf-8 encoding is not supported"
);
throw
new
ExcelException
(
"Utf-8 encoding is not supported"
);
...
@@ -42,7 +49,6 @@ public class EasyExcelExporter {
...
@@ -42,7 +49,6 @@ public class EasyExcelExporter {
LogUtil
.
error
(
e
.
getMessage
(),
e
);
LogUtil
.
error
(
e
.
getMessage
(),
e
);
throw
new
ExcelException
(
"IO exception"
);
throw
new
ExcelException
(
"IO exception"
);
}
}
}
}
public
void
close
()
{
public
void
close
()
{
...
...
backend/src/main/java/io/metersphere/performance/controller/PerformanceReportController.java
浏览文件 @
94dd8372
...
@@ -104,9 +104,9 @@ public class PerformanceReportController {
...
@@ -104,9 +104,9 @@ public class PerformanceReportController {
return
reportService
.
logs
(
reportId
);
return
reportService
.
logs
(
reportId
);
}
}
@GetMapping
(
"log/download/{
log
Id}"
)
@GetMapping
(
"log/download/{
reportId}/{resource
Id}"
)
public
ResponseEntity
<
byte
[]>
downloadLog
(
@PathVariable
String
log
Id
)
{
public
ResponseEntity
<
byte
[]>
downloadLog
(
@PathVariable
String
reportId
,
@PathVariable
String
resource
Id
)
{
byte
[]
bytes
=
reportService
.
downloadLog
(
log
Id
);
byte
[]
bytes
=
reportService
.
downloadLog
(
reportId
,
resource
Id
);
return
ResponseEntity
.
ok
()
return
ResponseEntity
.
ok
()
.
contentType
(
MediaType
.
parseMediaType
(
"application/octet-stream"
))
.
contentType
(
MediaType
.
parseMediaType
(
"application/octet-stream"
))
.
header
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename=\"jmeter.log\""
)
.
header
(
HttpHeaders
.
CONTENT_DISPOSITION
,
"attachment; filename=\"jmeter.log\""
)
...
...
backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java
浏览文件 @
94dd8372
...
@@ -79,7 +79,9 @@ public class PerformanceTestService {
...
@@ -79,7 +79,9 @@ public class PerformanceTestService {
// delete load_test_report, delete load_test_report_detail
// delete load_test_report, delete load_test_report_detail
reportIdList
.
forEach
(
reportId
->
{
reportIdList
.
forEach
(
reportId
->
{
loadTestReportDetailMapper
.
deleteByPrimaryKey
(
reportId
);
LoadTestReportDetailExample
example
=
new
LoadTestReportDetailExample
();
example
.
createCriteria
().
andReportIdEqualTo
(
reportId
);
loadTestReportDetailMapper
.
deleteByExample
(
example
);
reportService
.
deleteReport
(
reportId
);
reportService
.
deleteReport
(
reportId
);
});
});
...
@@ -202,7 +204,7 @@ public class PerformanceTestService {
...
@@ -202,7 +204,7 @@ public class PerformanceTestService {
}
}
private
void
startEngine
(
LoadTestWithBLOBs
loadTest
,
Engine
engine
)
{
private
void
startEngine
(
LoadTestWithBLOBs
loadTest
,
Engine
engine
)
{
LoadTestReport
WithBLOBs
testReport
=
new
LoadTestReportWithBLOBs
();
LoadTestReport
testReport
=
new
LoadTestReport
();
testReport
.
setId
(
engine
.
getReportId
());
testReport
.
setId
(
engine
.
getReportId
());
testReport
.
setCreateTime
(
engine
.
getStartTime
());
testReport
.
setCreateTime
(
engine
.
getStartTime
());
testReport
.
setUpdateTime
(
engine
.
getStartTime
());
testReport
.
setUpdateTime
(
engine
.
getStartTime
());
...
@@ -216,29 +218,16 @@ public class PerformanceTestService {
...
@@ -216,29 +218,16 @@ public class PerformanceTestService {
loadTest
.
setStatus
(
PerformanceTestStatus
.
Starting
.
name
());
loadTest
.
setStatus
(
PerformanceTestStatus
.
Starting
.
name
());
loadTestMapper
.
updateByPrimaryKeySelective
(
loadTest
);
loadTestMapper
.
updateByPrimaryKeySelective
(
loadTest
);
// 启动正常插入 report
// 启动正常插入 report
testReport
.
setContent
(
HEADERS
);
testReport
.
setStatus
(
PerformanceTestStatus
.
Starting
.
name
());
testReport
.
setStatus
(
PerformanceTestStatus
.
Starting
.
name
());
loadTestReportMapper
.
insertSelective
(
testReport
);
loadTestReportMapper
.
insertSelective
(
testReport
);
LoadTestReportDetail
reportDetail
=
new
LoadTestReportDetail
();
LoadTestReportDetail
reportDetail
=
new
LoadTestReportDetail
();
reportDetail
.
setContent
(
HEADERS
);
reportDetail
.
setContent
(
HEADERS
);
reportDetail
.
setReportId
(
testReport
.
getId
());
reportDetail
.
setReportId
(
testReport
.
getId
());
reportDetail
.
setPart
(
1L
);
loadTestReportDetailMapper
.
insertSelective
(
reportDetail
);
loadTestReportDetailMapper
.
insertSelective
(
reportDetail
);
// append \n
// append \n
extLoadTestReportMapper
.
appendLine
(
testReport
.
getId
(),
"\n"
);
// append \n
extLoadTestReportDetailMapper
.
appendLine
(
testReport
.
getId
(),
"\n"
);
extLoadTestReportDetailMapper
.
appendLine
(
testReport
.
getId
(),
"\n"
);
// 保存 load_test_report_log
String
resourcePoolId
=
loadTest
.
getTestResourcePoolId
();
List
<
TestResource
>
testResourceList
=
testResourceService
.
getResourcesByPoolId
(
resourcePoolId
);
testResourceList
.
forEach
(
r
->
{
LoadTestReportLog
record
=
new
LoadTestReportLog
();
record
.
setId
(
UUID
.
randomUUID
().
toString
());
record
.
setReportId
(
testReport
.
getId
());
record
.
setResourceId
(
r
.
getId
());
record
.
setContent
(
StringUtils
.
EMPTY
);
loadTestReportLogMapper
.
insert
(
record
);
});
}
catch
(
MSException
e
)
{
}
catch
(
MSException
e
)
{
LogUtil
.
error
(
e
);
LogUtil
.
error
(
e
);
loadTest
.
setStatus
(
PerformanceTestStatus
.
Error
.
name
());
loadTest
.
setStatus
(
PerformanceTestStatus
.
Error
.
name
());
...
...
backend/src/main/java/io/metersphere/performance/service/ReportService.java
浏览文件 @
94dd8372
...
@@ -24,7 +24,9 @@ import org.springframework.stereotype.Service;
...
@@ -24,7 +24,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -57,7 +59,7 @@ public class ReportService {
...
@@ -57,7 +59,7 @@ public class ReportService {
MSException
.
throwException
(
"report id cannot be null"
);
MSException
.
throwException
(
"report id cannot be null"
);
}
}
LoadTestReport
WithBLOBs
loadTestReport
=
loadTestReportMapper
.
selectByPrimaryKey
(
reportId
);
LoadTestReport
loadTestReport
=
loadTestReportMapper
.
selectByPrimaryKey
(
reportId
);
LoadTestWithBLOBs
loadTest
=
loadTestMapper
.
selectByPrimaryKey
(
loadTestReport
.
getTestId
());
LoadTestWithBLOBs
loadTest
=
loadTestMapper
.
selectByPrimaryKey
(
loadTestReport
.
getTestId
());
LogUtil
.
info
(
"Delete report started, report ID: %s"
+
reportId
);
LogUtil
.
info
(
"Delete report started, report ID: %s"
+
reportId
);
...
@@ -142,7 +144,7 @@ public class ReportService {
...
@@ -142,7 +144,7 @@ public class ReportService {
}
}
public
void
checkReportStatus
(
String
reportId
)
{
public
void
checkReportStatus
(
String
reportId
)
{
LoadTestReport
WithBLOBs
loadTestReport
=
loadTestReportMapper
.
selectByPrimaryKey
(
reportId
);
LoadTestReport
loadTestReport
=
loadTestReportMapper
.
selectByPrimaryKey
(
reportId
);
String
reportStatus
=
loadTestReport
.
getStatus
();
String
reportStatus
=
loadTestReport
.
getStatus
();
if
(
StringUtils
.
equals
(
PerformanceTestStatus
.
Running
.
name
(),
reportStatus
))
{
if
(
StringUtils
.
equals
(
PerformanceTestStatus
.
Running
.
name
(),
reportStatus
))
{
MSException
.
throwException
(
"Reporting in progress..."
);
MSException
.
throwException
(
"Reporting in progress..."
);
...
@@ -160,42 +162,50 @@ public class ReportService {
...
@@ -160,42 +162,50 @@ public class ReportService {
public
List
<
LogDetailDTO
>
logs
(
String
reportId
)
{
public
List
<
LogDetailDTO
>
logs
(
String
reportId
)
{
LoadTestReportLogExample
example
=
new
LoadTestReportLogExample
();
LoadTestReportLogExample
example
=
new
LoadTestReportLogExample
();
example
.
createCriteria
().
andReportIdEqualTo
(
reportId
);
example
.
createCriteria
().
andReportIdEqualTo
(
reportId
);
example
.
setOrderByClause
(
"part"
);
List
<
LoadTestReportLog
>
loadTestReportLogs
=
loadTestReportLogMapper
.
selectByExampleWithBLOBs
(
example
);
List
<
LoadTestReportLog
>
loadTestReportLogs
=
loadTestReportLogMapper
.
selectByExampleWithBLOBs
(
example
);
return
loadTestReportLogs
.
stream
().
map
(
log
->
{
Map
<
String
,
List
<
LoadTestReportLog
>>
reportLogs
=
loadTestReportLogs
.
stream
().
collect
(
Collectors
.
groupingBy
(
LoadTestReportLog:
:
getResourceId
));
List
<
LogDetailDTO
>
result
=
new
ArrayList
<>();
reportLogs
.
forEach
((
resourceId
,
resourceLogs
)
->
{
LogDetailDTO
detailDTO
=
new
LogDetailDTO
();
LogDetailDTO
detailDTO
=
new
LogDetailDTO
();
detailDTO
.
setId
(
log
.
getId
());
TestResource
testResource
=
testResourceService
.
getTestResource
(
resourceId
);
TestResource
testResource
=
testResourceService
.
getTestResource
(
log
.
getResourceId
());
String
content
=
resourceLogs
.
stream
().
map
(
LoadTestReportLog:
:
getContent
).
reduce
(
""
,
(
a
,
b
)
->
a
+
b
);
String
content
=
log
.
getContent
();
// 显示前 2048
// 显示前 2048
content
=
StringUtils
.
substring
(
content
,
0
,
2048
);
content
=
StringUtils
.
substring
(
content
,
0
,
2048
);
detailDTO
.
setResourceId
(
resourceId
);
detailDTO
.
setContent
(
content
);
detailDTO
.
setContent
(
content
);
if
(
testResource
==
null
)
{
if
(
testResource
==
null
)
{
detailDTO
.
setResourceName
(
log
.
getResourceId
());
detailDTO
.
setResourceName
(
resourceId
);
return
detailDTO
;
result
.
add
(
detailDTO
);
return
;
}
}
String
configuration
=
testResource
.
getConfiguration
();
String
configuration
=
testResource
.
getConfiguration
();
if
(
StringUtils
.
isBlank
(
configuration
))
{
if
(
StringUtils
.
isBlank
(
configuration
))
{
detailDTO
.
setResourceName
(
log
.
getResourceId
());
detailDTO
.
setResourceName
(
resourceId
);
return
detailDTO
;
result
.
add
(
detailDTO
);
return
;
}
}
JSONObject
object
=
JSON
.
parseObject
(
configuration
);
JSONObject
object
=
JSON
.
parseObject
(
configuration
);
if
(
StringUtils
.
isNotBlank
(
object
.
getString
(
"masterUrl"
)))
{
if
(
StringUtils
.
isNotBlank
(
object
.
getString
(
"masterUrl"
)))
{
detailDTO
.
setResourceName
(
object
.
getString
(
"masterUrl"
));
detailDTO
.
setResourceName
(
object
.
getString
(
"masterUrl"
));
return
detailDTO
;
result
.
add
(
detailDTO
);
return
;
}
}
if
(
StringUtils
.
isNotBlank
(
object
.
getString
(
"ip"
)))
{
if
(
StringUtils
.
isNotBlank
(
object
.
getString
(
"ip"
)))
{
detailDTO
.
setResourceName
(
object
.
getString
(
"ip"
));
detailDTO
.
setResourceName
(
object
.
getString
(
"ip"
));
re
turn
detailDTO
;
re
sult
.
add
(
detailDTO
)
;
}
}
return
detailDTO
;
})
;
}).
collect
(
Collectors
.
toList
())
;
return
result
;
}
}
public
byte
[]
downloadLog
(
String
logId
)
{
LoadTestReportLog
loadTestReportLog
=
loadTestReportLogMapper
.
selectByPrimaryKey
(
logId
);
public
byte
[]
downloadLog
(
String
reportId
,
String
resourceId
)
{
if
(
loadTestReportLog
!=
null
)
{
LoadTestReportLogExample
example
=
new
LoadTestReportLogExample
();
return
loadTestReportLog
.
getContent
().
getBytes
();
example
.
createCriteria
().
andReportIdEqualTo
(
reportId
).
andResourceIdEqualTo
(
resourceId
);
}
List
<
LoadTestReportLog
>
loadTestReportLogs
=
loadTestReportLogMapper
.
selectByExampleWithBLOBs
(
example
);
return
new
byte
[
0
];
String
content
=
loadTestReportLogs
.
stream
().
map
(
LoadTestReportLog:
:
getContent
).
reduce
(
""
,
(
a
,
b
)
->
a
+
b
);
return
content
.
getBytes
();
}
}
}
}
backend/src/main/java/io/metersphere/service/RoleService.java
浏览文件 @
94dd8372
package
io.metersphere.service
;
package
io.metersphere.service
;
import
io.metersphere.base.domain.Role
;
import
io.metersphere.base.domain.Role
;
import
io.metersphere.base.mapper.RoleMapper
;
import
io.metersphere.base.mapper.ext.ExtRoleMapper
;
import
io.metersphere.base.mapper.ext.ExtRoleMapper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -13,8 +14,14 @@ public class RoleService {
...
@@ -13,8 +14,14 @@ public class RoleService {
@Resource
@Resource
private
ExtRoleMapper
extRoleMapper
;
private
ExtRoleMapper
extRoleMapper
;
@Resource
private
RoleMapper
roleMapper
;
public
List
<
Role
>
getRoleList
(
String
sign
)
{
public
List
<
Role
>
getRoleList
(
String
sign
)
{
return
extRoleMapper
.
getRoleList
(
sign
);
return
extRoleMapper
.
getRoleList
(
sign
);
}
}
public
List
<
Role
>
getAllRole
()
{
return
roleMapper
.
selectByExample
(
null
);
}
}
}
backend/src/main/java/io/metersphere/service/UserRoleService.java
浏览文件 @
94dd8372
package
io.metersphere.service
;
package
io.metersphere.service
;
import
io.metersphere.base.domain.Role
;
import
io.metersphere.base.domain.Role
;
import
io.metersphere.base.domain.UserRole
;
import
io.metersphere.base.domain.UserRoleExample
;
import
io.metersphere.base.mapper.UserRoleMapper
;
import
io.metersphere.base.mapper.ext.ExtUserRoleMapper
;
import
io.metersphere.base.mapper.ext.ExtUserRoleMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
@@ -14,6 +22,8 @@ public class UserRoleService {
...
@@ -14,6 +22,8 @@ public class UserRoleService {
@Resource
@Resource
private
ExtUserRoleMapper
extUserRoleMapper
;
private
ExtUserRoleMapper
extUserRoleMapper
;
@Resource
private
UserRoleMapper
userRoleMapper
;
public
List
<
Role
>
getOrganizationMemberRoles
(
String
orgId
,
String
userId
)
{
public
List
<
Role
>
getOrganizationMemberRoles
(
String
orgId
,
String
userId
)
{
return
extUserRoleMapper
.
getOrganizationMemberRoles
(
orgId
,
userId
);
return
extUserRoleMapper
.
getOrganizationMemberRoles
(
orgId
,
userId
);
...
@@ -23,4 +33,28 @@ public class UserRoleService {
...
@@ -23,4 +33,28 @@ public class UserRoleService {
return
extUserRoleMapper
.
getWorkspaceMemberRoles
(
workspaceId
,
userId
);
return
extUserRoleMapper
.
getWorkspaceMemberRoles
(
workspaceId
,
userId
);
}
}
public
List
<
Map
<
String
,
Object
>>
getUserRole
(
String
userId
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
UserRoleExample
userRoleExample
=
new
UserRoleExample
();
userRoleExample
.
createCriteria
().
andUserIdEqualTo
(
userId
);
List
<
UserRole
>
userRoles
=
userRoleMapper
.
selectByExample
(
userRoleExample
);
List
<
String
>
collect
=
userRoles
.
stream
()
.
map
(
userRole
->
userRole
.
getRoleId
())
.
distinct
()
.
collect
(
Collectors
.
toList
());
for
(
int
i
=
0
;
i
<
collect
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
map
.
put
(
"id"
,
collect
.
get
(
i
));
map
.
put
(
"Ids"
,
new
ArrayList
<>());
for
(
int
j
=
0
;
j
<
userRoles
.
size
();
j
++)
{
String
role
=
userRoles
.
get
(
j
).
getRoleId
();
if
(
StringUtils
.
equals
(
role
,
collect
.
get
(
i
)))
{
List
ids
=
(
List
)
map
.
get
(
"Ids"
);
ids
.
add
(
userRoles
.
get
(
j
).
getSourceId
());
}
}
list
.
add
(
map
);
}
return
list
;
}
}
}
backend/src/main/java/io/metersphere/service/UserService.java
浏览文件 @
94dd8372
...
@@ -4,12 +4,13 @@ import io.metersphere.base.domain.*;
...
@@ -4,12 +4,13 @@ import io.metersphere.base.domain.*;
import
io.metersphere.base.mapper.*
;
import
io.metersphere.base.mapper.*
;
import
io.metersphere.base.mapper.ext.ExtUserMapper
;
import
io.metersphere.base.mapper.ext.ExtUserMapper
;
import
io.metersphere.base.mapper.ext.ExtUserRoleMapper
;
import
io.metersphere.base.mapper.ext.ExtUserRoleMapper
;
import
io.metersphere.commons.constants.RoleConstants
;
import
io.metersphere.commons.exception.MSException
;
import
io.metersphere.commons.exception.MSException
;
import
io.metersphere.commons.user.SessionUser
;
import
io.metersphere.commons.user.SessionUser
;
import
io.metersphere.commons.utils.CodingUtil
;
import
io.metersphere.commons.utils.CodingUtil
;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.controller.request.UserRequest
;
import
io.metersphere.controller.request.member.AddMemberRequest
;
import
io.metersphere.controller.request.member.AddMemberRequest
;
import
io.metersphere.controller.request.member.UserRequest
;
import
io.metersphere.controller.request.member.EditPassWordRequest
;
import
io.metersphere.controller.request.member.EditPassWordRequest
;
import
io.metersphere.controller.request.member.QueryMemberRequest
;
import
io.metersphere.controller.request.member.QueryMemberRequest
;
import
io.metersphere.controller.request.organization.AddOrgMemberRequest
;
import
io.metersphere.controller.request.organization.AddOrgMemberRequest
;
...
@@ -23,8 +24,7 @@ import org.springframework.stereotype.Service;
...
@@ -23,8 +24,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.*
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -46,7 +46,7 @@ public class UserService {
...
@@ -46,7 +46,7 @@ public class UserService {
@Resource
@Resource
private
ExtUserMapper
extUserMapper
;
private
ExtUserMapper
extUserMapper
;
public
UserDTO
insert
(
User
user
)
{
public
UserDTO
insert
(
User
Request
user
)
{
checkUserParam
(
user
);
checkUserParam
(
user
);
//
//
String
id
=
user
.
getId
();
String
id
=
user
.
getId
();
...
@@ -56,9 +56,44 @@ public class UserService {
...
@@ -56,9 +56,44 @@ public class UserService {
}
else
{
}
else
{
createUser
(
user
);
createUser
(
user
);
}
}
List
<
Map
<
String
,
Object
>>
roles
=
user
.
getRoles
();
if
(!
roles
.
isEmpty
())
{
insertUserRole
(
roles
,
user
.
getId
());
}
return
getUserDTO
(
user
.
getId
());
return
getUserDTO
(
user
.
getId
());
}
}
private
void
insertUserRole
(
List
<
Map
<
String
,
Object
>>
roles
,
String
userId
)
{
for
(
int
i
=
0
;
i
<
roles
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
roles
.
get
(
i
);
String
role
=
(
String
)
map
.
get
(
"id"
);
if
(
StringUtils
.
equals
(
role
,
RoleConstants
.
ADMIN
))
{
UserRole
userRole
=
new
UserRole
();
userRole
.
setId
(
UUID
.
randomUUID
().
toString
());
userRole
.
setUserId
(
userId
);
userRole
.
setUpdateTime
(
System
.
currentTimeMillis
());
userRole
.
setCreateTime
(
System
.
currentTimeMillis
());
userRole
.
setRoleId
(
role
);
// TODO 修改
userRole
.
setSourceId
(
"adminSourceId"
);
userRoleMapper
.
insertSelective
(
userRole
);
}
else
{
List
<
String
>
list
=
(
List
<
String
>)
map
.
get
(
"Ids"
);
for
(
int
j
=
0
;
j
<
list
.
size
();
j
++)
{
UserRole
userRole1
=
new
UserRole
();
userRole1
.
setId
(
UUID
.
randomUUID
().
toString
());
userRole1
.
setUserId
(
userId
);
userRole1
.
setRoleId
(
role
);
userRole1
.
setUpdateTime
(
System
.
currentTimeMillis
());
userRole1
.
setCreateTime
(
System
.
currentTimeMillis
());
userRole1
.
setSourceId
(
list
.
get
(
j
));
// TODO 防止重复插入
userRoleMapper
.
insertSelective
(
userRole1
);
}
}
}
}
private
void
checkUserParam
(
User
user
)
{
private
void
checkUserParam
(
User
user
)
{
if
(
StringUtils
.
isBlank
(
user
.
getName
()))
{
if
(
StringUtils
.
isBlank
(
user
.
getName
()))
{
...
@@ -132,7 +167,7 @@ public class UserService {
...
@@ -132,7 +167,7 @@ public class UserService {
return
userMapper
.
selectByExample
(
null
);
return
userMapper
.
selectByExample
(
null
);
}
}
public
List
<
User
>
getUserListWithRequest
(
UserRequest
request
)
{
public
List
<
User
>
getUserListWithRequest
(
io
.
metersphere
.
controller
.
request
.
UserRequest
request
)
{
return
extUserMapper
.
getUserList
(
request
);
return
extUserMapper
.
getUserList
(
request
);
}
}
...
@@ -144,6 +179,19 @@ public class UserService {
...
@@ -144,6 +179,19 @@ public class UserService {
userMapper
.
deleteByPrimaryKey
(
userId
);
userMapper
.
deleteByPrimaryKey
(
userId
);
}
}
public
void
updateUserRole
(
UserRequest
user
)
{
String
userId
=
user
.
getId
();
UserRoleExample
userRoleExample
=
new
UserRoleExample
();
userRoleExample
.
createCriteria
().
andUserIdEqualTo
(
userId
);
userRoleMapper
.
deleteByExample
(
userRoleExample
);
List
<
Map
<
String
,
Object
>>
roles
=
user
.
getRoles
();
if
(!
roles
.
isEmpty
())
{
insertUserRole
(
roles
,
user
.
getId
());
}
user
.
setUpdateTime
(
System
.
currentTimeMillis
());
userMapper
.
updateByPrimaryKeySelective
(
user
);
}
public
void
updateUser
(
User
user
)
{
public
void
updateUser
(
User
user
)
{
user
.
setUpdateTime
(
System
.
currentTimeMillis
());
user
.
setUpdateTime
(
System
.
currentTimeMillis
());
userMapper
.
updateByPrimaryKeySelective
(
user
);
userMapper
.
updateByPrimaryKeySelective
(
user
);
...
@@ -268,7 +316,7 @@ public class UserService {
...
@@ -268,7 +316,7 @@ public class UserService {
public
void
setLanguage
(
String
lang
)
{
public
void
setLanguage
(
String
lang
)
{
if
(
SessionUtils
.
getUser
()
!=
null
)
{
if
(
SessionUtils
.
getUser
()
!=
null
)
{
User
user
=
new
User
();
User
Request
user
=
new
UserRequest
();
user
.
setId
(
SessionUtils
.
getUser
().
getId
());
user
.
setId
(
SessionUtils
.
getUser
().
getId
());
user
.
setLanguage
(
lang
);
user
.
setLanguage
(
lang
);
updateUser
(
user
);
updateUser
(
user
);
...
...
backend/src/main/java/io/metersphere/track/service/TestCaseService.java
浏览文件 @
94dd8372
...
@@ -221,8 +221,8 @@ public class TestCaseService {
...
@@ -221,8 +221,8 @@ public class TestCaseService {
public
void
testCaseTemplateExport
(
HttpServletResponse
response
)
{
public
void
testCaseTemplateExport
(
HttpServletResponse
response
)
{
EasyExcelExporter
easyExcelExporter
=
null
;
EasyExcelExporter
easyExcelExporter
=
null
;
try
{
try
{
easyExcelExporter
=
new
EasyExcelExporter
();
easyExcelExporter
=
new
EasyExcelExporter
(
TestCaseExcelData
.
class
);
easyExcelExporter
.
export
(
response
,
TestCaseExcelData
.
class
,
generateExportTemplate
(),
easyExcelExporter
.
export
(
response
,
generateExportTemplate
(),
Translator
.
get
(
"test_case_import_template_name"
),
Translator
.
get
(
"test_case_import_template_sheet"
));
Translator
.
get
(
"test_case_import_template_name"
),
Translator
.
get
(
"test_case_import_template_sheet"
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
MSException
.
throwException
(
e
);
MSException
.
throwException
(
e
);
...
...
backend/src/main/java/io/metersphere/track/service/TestPlanService.java
浏览文件 @
94dd8372
...
@@ -162,7 +162,7 @@ public class TestPlanService {
...
@@ -162,7 +162,7 @@ public class TestPlanService {
QueryTestPlanRequest
request
=
new
QueryTestPlanRequest
();
QueryTestPlanRequest
request
=
new
QueryTestPlanRequest
();
request
.
setPrincipal
(
user
.
getId
());
request
.
setPrincipal
(
user
.
getId
());
request
.
setWorkspaceId
(
SessionUtils
.
getCurrentWorkspaceId
());
request
.
setWorkspaceId
(
SessionUtils
.
getCurrentWorkspaceId
());
request
.
setPlanIds
(
extTestPlanTestCaseMapper
.
findRelateTestPlanId
(
user
.
getId
()));
request
.
setPlanIds
(
extTestPlanTestCaseMapper
.
findRelateTestPlanId
(
user
.
getId
()
,
SessionUtils
.
getCurrentWorkspaceId
()
));
List
<
String
>
projectIds
=
extProjectMapper
.
getProjectIdByWorkspaceId
(
SessionUtils
.
getCurrentOrganizationId
());
List
<
String
>
projectIds
=
extProjectMapper
.
getProjectIdByWorkspaceId
(
SessionUtils
.
getCurrentOrganizationId
());
...
@@ -205,9 +205,9 @@ public class TestPlanService {
...
@@ -205,9 +205,9 @@ public class TestPlanService {
}
}
private
double
getPercentWithTwoDecimals
(
double
value
)
{
private
double
getPercentWithTwoDecimals
(
double
value
)
{
return
new
BigDecimal
(
value
)
return
new
BigDecimal
(
value
*
100
)
.
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
)
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
)
.
doubleValue
()
*
100
;
.
doubleValue
();
}
}
public
List
<
TestPlanCaseDTO
>
listTestCaseByPlanId
(
String
planId
)
{
public
List
<
TestPlanCaseDTO
>
listTestCaseByPlanId
(
String
planId
)
{
...
@@ -329,7 +329,7 @@ public class TestPlanService {
...
@@ -329,7 +329,7 @@ public class TestPlanService {
}
}
}
}
public
List
<
TestPlan
>
getTestPlanBy
Test
Ids
(
List
<
String
>
planIds
)
{
public
List
<
TestPlan
>
getTestPlanByIds
(
List
<
String
>
planIds
)
{
TestPlanExample
example
=
new
TestPlanExample
();
TestPlanExample
example
=
new
TestPlanExample
();
example
.
createCriteria
().
andIdIn
(
planIds
);
example
.
createCriteria
().
andIdIn
(
planIds
);
return
testPlanMapper
.
selectByExample
(
example
);
return
testPlanMapper
.
selectByExample
(
example
);
...
...
backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java
浏览文件 @
94dd8372
...
@@ -80,10 +80,15 @@ public class TestPlanTestCaseService {
...
@@ -80,10 +80,15 @@ public class TestPlanTestCaseService {
if
(
request
.
getPlanIds
().
isEmpty
())
{
if
(
request
.
getPlanIds
().
isEmpty
())
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
List
<
TestPlanCaseDTO
>
recentTestedTestCase
=
extTestPlanTestCaseMapper
.
getRecentTestedTestCase
(
request
);
List
<
TestPlanCaseDTO
>
recentTestedTestCase
=
extTestPlanTestCaseMapper
.
getRecentTestedTestCase
(
request
);
List
<
String
>
planIds
=
recentTestedTestCase
.
stream
().
map
(
TestPlanCaseDTO:
:
getPlanId
).
collect
(
Collectors
.
toList
());
List
<
String
>
planIds
=
recentTestedTestCase
.
stream
().
map
(
TestPlanCaseDTO:
:
getPlanId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
testPlanMap
=
testPlanService
.
getTestPlanByTestIds
(
planIds
).
stream
()
if
(
planIds
.
isEmpty
())
{
return
new
ArrayList
<>();
}
Map
<
String
,
String
>
testPlanMap
=
testPlanService
.
getTestPlanByIds
(
planIds
).
stream
()
.
collect
(
Collectors
.
toMap
(
TestPlan:
:
getId
,
TestPlan:
:
getName
));
.
collect
(
Collectors
.
toMap
(
TestPlan:
:
getId
,
TestPlan:
:
getName
));
recentTestedTestCase
.
forEach
(
testCase
->
{
recentTestedTestCase
.
forEach
(
testCase
->
{
...
@@ -102,7 +107,7 @@ public class TestPlanTestCaseService {
...
@@ -102,7 +107,7 @@ public class TestPlanTestCaseService {
public
void
buildQueryRequest
(
QueryTestPlanCaseRequest
request
,
int
count
)
{
public
void
buildQueryRequest
(
QueryTestPlanCaseRequest
request
,
int
count
)
{
SessionUser
user
=
SessionUtils
.
getUser
();
SessionUser
user
=
SessionUtils
.
getUser
();
List
<
String
>
relateTestPlanIds
=
extTestPlanTestCaseMapper
.
findRelateTestPlanId
(
user
.
getId
());
List
<
String
>
relateTestPlanIds
=
extTestPlanTestCaseMapper
.
findRelateTestPlanId
(
user
.
getId
()
,
SessionUtils
.
getCurrentWorkspaceId
()
);
PageHelper
.
startPage
(
1
,
count
,
true
);
PageHelper
.
startPage
(
1
,
count
,
true
);
request
.
setPlanIds
(
relateTestPlanIds
);
request
.
setPlanIds
(
relateTestPlanIds
);
request
.
setExecutor
(
user
.
getId
());
request
.
setExecutor
(
user
.
getId
());
...
...
backend/src/main/resources/db/migration/V2__metersphere_ddl.sql
浏览文件 @
94dd8372
...
@@ -51,7 +51,6 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
...
@@ -51,7 +51,6 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
`test_id`
varchar
(
50
)
NOT
NULL
COMMENT
'Test ID this test report belongs to'
,
`test_id`
varchar
(
50
)
NOT
NULL
COMMENT
'Test ID this test report belongs to'
,
`name`
varchar
(
64
)
NOT
NULL
COMMENT
'Test report name'
,
`name`
varchar
(
64
)
NOT
NULL
COMMENT
'Test report name'
,
`description`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'Test report name'
,
`description`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'Test report name'
,
`content`
longtext
,
`create_time`
bigint
(
13
)
NOT
NULL
COMMENT
'Create timestamp'
,
`create_time`
bigint
(
13
)
NOT
NULL
COMMENT
'Create timestamp'
,
`update_time`
bigint
(
13
)
NOT
NULL
COMMENT
'Update timestamp'
,
`update_time`
bigint
(
13
)
NOT
NULL
COMMENT
'Update timestamp'
,
`status`
varchar
(
64
)
NOT
NULL
COMMENT
'Status of this test run'
,
`status`
varchar
(
64
)
NOT
NULL
COMMENT
'Status of this test run'
,
...
@@ -64,20 +63,19 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
...
@@ -64,20 +63,19 @@ CREATE TABLE IF NOT EXISTS `load_test_report` (
CREATE
TABLE
IF
NOT
EXISTS
`load_test_report_detail`
(
CREATE
TABLE
IF
NOT
EXISTS
`load_test_report_detail`
(
`report_id`
varchar
(
50
)
NOT
NULL
,
`report_id`
varchar
(
50
)
NOT
NULL
,
`content`
longtext
,
`content`
longtext
,
PRIMARY
KEY
(
`report_id`
)
`part`
bigint
(
11
)
NOT
NULL
,
)
PRIMARY
KEY
(
`report_id`
,
`part`
)
ENGINE
=
InnoDB
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_bin
;
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_bin
;
CREATE
TABLE
IF
NOT
EXISTS
`load_test_report_log`
(
CREATE
TABLE
IF
NOT
EXISTS
`load_test_report_log`
(
`id`
varchar
(
50
)
NOT
NULL
,
`id`
varchar
(
50
)
NOT
NULL
,
`report_id`
varchar
(
50
)
NOT
NULL
,
`report_id`
varchar
(
50
)
NOT
NULL
,
`resource_id`
varchar
(
50
)
DEFAULT
NULL
,
`resource_id`
varchar
(
50
)
DEFAULT
NULL
,
`content`
longtext
,
`content`
longtext
,
`part`
bigint
(
20
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
),
PRIMARY
KEY
(
`id`
),
KEY
`load_test_report_log_report_id_resource_name_index`
(
`report_id`
,
`resource_id`
)
KEY
`load_test_report_log_report_id_resource_name_index`
(
`report_id`
,
`resource_id`
,
`part`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_bin
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_bin
;
CREATE
TABLE
IF
NOT
EXISTS
`load_test_report_result`
(
CREATE
TABLE
IF
NOT
EXISTS
`load_test_report_result`
(
`id`
varchar
(
50
)
NOT
NULL
,
`id`
varchar
(
50
)
NOT
NULL
,
...
...
backend/src/main/resources/generatorConfig.xml
浏览文件 @
94dd8372
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
<!--要生成的数据库表 -->
<!--要生成的数据库表 -->
<table
tableName=
"
test_plan_test_case
"
/>
<table
tableName=
"
load_test_report
"
/>
</context>
</context>
</generatorConfiguration>
</generatorConfiguration>
\ No newline at end of file
frontend/src/business/components/api/home/ApiTestRecentList.vue
浏览文件 @
94dd8372
<
template
>
<
template
>
<el-card
class=
"table-card"
v-loading=
"result.loading"
>
<el-card
class=
"table-card"
v-loading=
"result.loading"
>
<template
v-slot:header
>
<template
v-slot:header
>
<span
class=
"title"
>
{{
$t
(
'
api_test.title
'
)
}}
</span>
<span
class=
"title"
>
{{
$t
(
'
commons.test
'
)
}}
</span>
</
template
>
</
template
>
<el-table
:data=
"tableData"
class=
"table-content"
>
<el-table
:data=
"tableData"
class=
"table-content"
>
<el-table-column
:label=
"$t('commons.name')"
width=
"150"
show-overflow-tooltip
>
<el-table-column
:label=
"$t('commons.name')"
width=
"150"
show-overflow-tooltip
>
...
...
frontend/src/business/components/api/test/ApiTestList.vue
浏览文件 @
94dd8372
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<ms-main-container>
<ms-main-container>
<el-card
class=
"table-card"
v-loading=
"result.loading"
>
<el-card
class=
"table-card"
v-loading=
"result.loading"
>
<template
v-slot:header
>
<template
v-slot:header
>
<ms-table-header
:condition.sync=
"condition"
@
search=
"search"
:title=
"$t('
api_test.title
')"
<ms-table-header
:condition.sync=
"condition"
@
search=
"search"
:title=
"$t('
commons.test
')"
@
create=
"create"
:createTip=
"$t('load_test.create')"
/>
@
create=
"create"
:createTip=
"$t('load_test.create')"
/>
</
template
>
</
template
>
<el-table
:data=
"tableData"
class=
"table-content"
>
<el-table
:data=
"tableData"
class=
"table-content"
>
...
...
frontend/src/business/components/performance/home/PerformanceTestRecentList.vue
浏览文件 @
94dd8372
<
template
>
<
template
>
<el-card
class=
"table-card"
v-loading=
"result.loading"
>
<el-card
class=
"table-card"
v-loading=
"result.loading"
>
<template
v-slot:header
>
<template
v-slot:header
>
<span
class=
"title"
>
{{
$t
(
'
api_test.title
'
)
}}
</span>
<span
class=
"title"
>
{{
$t
(
'
commons.test
'
)
}}
</span>
</
template
>
</
template
>
<el-table
:data=
"tableData"
class=
"table-content"
>
<el-table
:data=
"tableData"
class=
"table-content"
>
<el-table-column
:label=
"$t('commons.name')"
width=
"150"
show-overflow-tooltip
>
<el-table-column
:label=
"$t('commons.name')"
width=
"150"
show-overflow-tooltip
>
...
...
frontend/src/business/components/performance/report/components/LogDetails.vue
浏览文件 @
94dd8372
<
template
>
<
template
>
<div
v-loading=
"result.loading"
>
<div
v-loading=
"result.loading"
>
<el-tabs
type=
"border-card"
:stretch=
"true"
>
<el-tabs
type=
"border-card"
:stretch=
"true"
>
<el-tab-pane
v-for=
"item in logContent"
:key=
"item.
i
d"
:label=
"item.resourceName"
class=
"logging-content"
>
<el-tab-pane
v-for=
"item in logContent"
:key=
"item.
resourceI
d"
:label=
"item.resourceName"
class=
"logging-content"
>
{{
item
.
content
}}
...
{{
item
.
content
}}
...
<el-link
type=
"primary"
@
click=
"downloadLogFile(item)"
>
{{
$t
(
'
load_test.download_log_file
'
)
}}
</el-link>
<el-link
type=
"primary"
@
click=
"downloadLogFile(item)"
>
{{
$t
(
'
load_test.download_log_file
'
)
}}
</el-link>
</el-tab-pane>
</el-tab-pane>
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
},
},
downloadLogFile
(
item
)
{
downloadLogFile
(
item
)
{
let
config
=
{
let
config
=
{
url
:
'
/performance/report/log/download/
'
+
item
.
i
d
,
url
:
'
/performance/report/log/download/
'
+
this
.
id
+
'
/
'
+
item
.
resourceI
d
,
method
:
'
get
'
,
method
:
'
get
'
,
responseType
:
'
blob
'
responseType
:
'
blob
'
};
};
...
...
frontend/src/business/components/settings/system/User.vue
浏览文件 @
94dd8372
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"email"
:label=
"$t('commons.email')"
/>
<el-table-column
prop=
"email"
:label=
"$t('commons.email')"
/>
<el-table-column
prop=
"status"
:label=
"$t('commons.status')"
>
<el-table-column
prop=
"status"
:label=
"$t('commons.status')"
width=
"120"
>
<
template
v-slot:default=
"scope"
>
<
template
v-slot:default=
"scope"
>
<el-switch
v-model=
"scope.row.status"
<el-switch
v-model=
"scope.row.status"
active-color=
"#13ce66"
active-color=
"#13ce66"
...
@@ -49,9 +49,9 @@
...
@@ -49,9 +49,9 @@
</el-card>
</el-card>
<!--Create user-->
<!--Create user-->
<el-dialog
:title=
"$t('user.create')"
:visible.sync=
"createVisible"
width=
"3
0
%"
@
closed=
"handleClose"
<el-dialog
:title=
"$t('user.create')"
:visible.sync=
"createVisible"
width=
"3
5
%"
@
closed=
"handleClose"
:destroy-on-close=
"true"
>
:destroy-on-close=
"true"
>
<el-form
:model=
"form"
label-position=
"right"
label-width=
"1
0
0px"
size=
"small"
:rules=
"rule"
ref=
"createUserForm"
>
<el-form
:model=
"form"
label-position=
"right"
label-width=
"1
2
0px"
size=
"small"
:rules=
"rule"
ref=
"createUserForm"
>
<el-form-item
label=
"ID"
prop=
"id"
>
<el-form-item
label=
"ID"
prop=
"id"
>
<el-input
v-model=
"form.id"
autocomplete=
"off"
/>
<el-input
v-model=
"form.id"
autocomplete=
"off"
/>
</el-form-item>
</el-form-item>
...
@@ -67,6 +67,74 @@
...
@@ -67,6 +67,74 @@
<el-form-item
:label=
"$t('commons.password')"
prop=
"password"
>
<el-form-item
:label=
"$t('commons.password')"
prop=
"password"
>
<el-input
v-model=
"form.password"
autocomplete=
"off"
show-password
/>
<el-input
v-model=
"form.password"
autocomplete=
"off"
show-password
/>
</el-form-item>
</el-form-item>
<div
v-for=
"(role, index) in form.roles"
:key=
"index"
>
<el-form-item
:label=
"'角色'+index"
:required=
"true"
>
<el-select
v-model=
"role.id"
placeholder=
"选择角色类型"
>
<el-option
v-for=
"item in userRole"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
<el-button
@
click.prevent=
"removeRole(role)"
style=
"margin-left: 20px;"
v-if=
"form.roles.length > 1"
>
删除
</el-button>
</el-form-item>
<div
v-if=
"role.id === 'org_admin'"
>
<el-form-item
label=
"选择组织"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择组织"
multiple
>
<el-option
v-for=
"item in form.orgList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<div
v-if=
"role.id === 'test_manager'"
>
<el-form-item
label=
"选择工作空间"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择工作空间"
multiple
>
<el-option
v-for=
"item in form.wsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<div
v-if=
"role.id ==='test_user'"
>
<el-form-item
label=
"选择工作空间"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择工作空间"
multiple
>
<el-option
v-for=
"item in form.wsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<div
v-if=
"role.id ==='test_viewer'"
>
<el-form-item
label=
"选择工作空间"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择工作空间"
multiple
>
<el-option
v-for=
"item in form.wsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<el-form-item>
<
template
>
<el-button
type=
"success"
style=
"width: 100%;"
@
click=
"addRole()"
>
添加角色
</el-button>
</
template
>
</el-form-item>
</el-form>
</el-form>
<
template
v-slot:footer
>
<
template
v-slot:footer
>
<ms-dialog-footer
<ms-dialog-footer
...
@@ -78,7 +146,7 @@
...
@@ -78,7 +146,7 @@
<!--Modify user information in system settings-->
<!--Modify user information in system settings-->
<el-dialog
:title=
"$t('user.modify')"
:visible.sync=
"updateVisible"
width=
"30%"
:destroy-on-close=
"true"
<el-dialog
:title=
"$t('user.modify')"
:visible.sync=
"updateVisible"
width=
"30%"
:destroy-on-close=
"true"
@
close=
"handleClose"
>
@
close=
"handleClose"
>
<el-form
:model=
"form"
label-position=
"right"
label-width=
"1
0
0px"
size=
"small"
:rules=
"rule"
ref=
"updateUserForm"
>
<el-form
:model=
"form"
label-position=
"right"
label-width=
"1
2
0px"
size=
"small"
:rules=
"rule"
ref=
"updateUserForm"
>
<el-form-item
label=
"ID"
prop=
"id"
>
<el-form-item
label=
"ID"
prop=
"id"
>
<el-input
v-model=
"form.id"
autocomplete=
"off"
:disabled=
"true"
/>
<el-input
v-model=
"form.id"
autocomplete=
"off"
:disabled=
"true"
/>
</el-form-item>
</el-form-item>
...
@@ -91,6 +159,73 @@
...
@@ -91,6 +159,73 @@
<el-form-item
:label=
"$t('commons.phone')"
prop=
"phone"
>
<el-form-item
:label=
"$t('commons.phone')"
prop=
"phone"
>
<el-input
v-model=
"form.phone"
autocomplete=
"off"
/>
<el-input
v-model=
"form.phone"
autocomplete=
"off"
/>
</el-form-item>
</el-form-item>
<div
v-for=
"(role, index) in form.roles"
:key=
"index"
>
<el-form-item
:label=
"'角色'+index"
:required=
"true"
>
<el-select
v-model=
"role.id"
placeholder=
"选择角色类型"
>
<el-option
v-for=
"item in userRole"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
<el-button
@
click.prevent=
"removeRole(role)"
style=
"margin-left: 20px;"
v-if=
"form.roles.length > 1"
>
删除
</el-button>
</el-form-item>
<div
v-if=
"role.id === 'org_admin'"
>
<el-form-item
label=
"选择组织"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择组织"
multiple
>
<el-option
v-for=
"item in form.orgList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<div
v-if=
"role.id === 'test_manager'"
>
<el-form-item
label=
"选择工作空间"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择工作空间"
multiple
>
<el-option
v-for=
"item in form.wsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<div
v-if=
"role.id ==='test_user'"
>
<el-form-item
label=
"选择工作空间"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择工作空间"
multiple
>
<el-option
v-for=
"item in form.wsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
<div
v-if=
"role.id ==='test_viewer'"
>
<el-form-item
label=
"选择工作空间"
:required=
"true"
>
<el-select
v-model=
"role.Ids"
placeholder=
"选择工作空间"
multiple
>
<el-option
v-for=
"item in form.wsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<el-form-item>
<
template
>
<el-button
type=
"success"
style=
"width: 100%;"
@
click=
"addRole()"
>
添加角色
</el-button>
</
template
>
</el-form-item>
</el-form>
</el-form>
<
template
v-slot:footer
>
<
template
v-slot:footer
>
<ms-dialog-footer
<ms-dialog-footer
...
@@ -152,12 +287,15 @@
...
@@ -152,12 +287,15 @@
updateVisible
:
false
,
updateVisible
:
false
,
editPasswordVisible
:
false
,
editPasswordVisible
:
false
,
multipleSelection
:
[],
multipleSelection
:
[],
userRole
:
[],
currentPage
:
1
,
currentPage
:
1
,
pageSize
:
5
,
pageSize
:
5
,
total
:
0
,
total
:
0
,
condition
:
{},
condition
:
{},
tableData
:
[],
tableData
:
[],
form
:
{},
form
:
{
roles
:
[{}]
},
checkPasswordForm
:
{},
checkPasswordForm
:
{},
ruleForm
:
{},
ruleForm
:
{},
setAdminParam
:
{},
setAdminParam
:
{},
...
@@ -216,14 +354,27 @@
...
@@ -216,14 +354,27 @@
},
},
created
()
{
created
()
{
this
.
search
();
this
.
search
();
this
.
getAllRole
();
},
},
methods
:
{
methods
:
{
create
()
{
create
()
{
this
.
createVisible
=
true
;
this
.
createVisible
=
true
;
this
.
getOrgList
();
this
.
getWsList
();
},
},
edit
(
row
)
{
edit
(
row
)
{
this
.
updateVisible
=
true
;
this
.
updateVisible
=
true
;
this
.
form
=
Object
.
assign
({},
row
);
this
.
form
=
Object
.
assign
({},
row
);
this
.
$get
(
"
/organization/list
"
,
response
=>
{
this
.
$set
(
this
.
form
,
"
orgList
"
,
response
.
data
);
});
this
.
$get
(
"
/workspace/list
"
,
response
=>
{
this
.
$set
(
this
.
form
,
"
wsList
"
,
response
.
data
);
});
this
.
$get
(
'
/userrole/all/
'
+
row
.
id
,
response
=>
{
let
data
=
response
.
data
;
this
.
$set
(
this
.
form
,
"
roles
"
,
data
);
});
},
},
editPassword
(
row
)
{
editPassword
(
row
)
{
this
.
editPasswordVisible
=
true
;
this
.
editPasswordVisible
=
true
;
...
@@ -295,12 +446,12 @@
...
@@ -295,12 +446,12 @@
let
roles
=
data
.
roles
;
let
roles
=
data
.
roles
;
// let userRoles = result.userRoles;
// let userRoles = result.userRoles;
this
.
$set
(
this
.
tableData
[
i
],
"
roles
"
,
roles
);
this
.
$set
(
this
.
tableData
[
i
],
"
roles
"
,
roles
);
})
})
;
}
}
})
})
},
},
handleClose
()
{
handleClose
()
{
this
.
form
=
{};
this
.
form
=
{
roles
:
[{
value
:
''
}]
};
},
},
changeSwitch
(
row
)
{
changeSwitch
(
row
)
{
this
.
$post
(
this
.
updatePath
,
row
,
()
=>
{
this
.
$post
(
this
.
updatePath
,
row
,
()
=>
{
...
@@ -312,7 +463,32 @@
...
@@ -312,7 +463,32 @@
},
},
handleSelectionChange
(
val
)
{
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
;
this
.
multipleSelection
=
val
;
}
},
getOrgList
()
{
this
.
$get
(
"
/organization/list
"
,
response
=>
{
this
.
$set
(
this
.
form
,
"
orgList
"
,
response
.
data
);
})
},
getWsList
()
{
this
.
$get
(
"
/workspace/list
"
,
response
=>
{
this
.
$set
(
this
.
form
,
"
wsList
"
,
response
.
data
);
})
},
getAllRole
()
{
this
.
$get
(
"
/role/all
"
,
response
=>
{
this
.
userRole
=
response
.
data
;
})
},
addRole
()
{
let
roles
=
this
.
form
.
roles
;
roles
.
push
({});
},
removeRole
(
item
)
{
let
index
=
this
.
form
.
roles
.
indexOf
(
item
)
if
(
index
!==
-
1
)
{
this
.
form
.
roles
.
splice
(
index
,
1
)
}
},
}
}
}
}
</
script
>
</
script
>
...
...
frontend/src/business/components/track/case/components/TestCaseEdit.vue
浏览文件 @
94dd8372
...
@@ -99,6 +99,7 @@
...
@@ -99,6 +99,7 @@
<el-row
style=
"margin-bottom: 10px"
>
<el-row
style=
"margin-bottom: 10px"
>
<el-col
:offset=
"2"
>
{{
$t
(
'
test_track.case.steps
'
)
}}
:
</el-col>
<el-col
:offset=
"2"
>
{{
$t
(
'
test_track.case.steps
'
)
}}
:
</el-col>
</el-row>
</el-row>
<el-row
type=
"flex"
justify=
"center"
>
<el-row
type=
"flex"
justify=
"center"
>
<el-col
:span=
"20"
>
<el-col
:span=
"20"
>
<el-table
<el-table
...
@@ -162,7 +163,7 @@
...
@@ -162,7 +163,7 @@
</el-row>
</el-row>
<el-row
type=
"flex"
justify=
"center"
>
<el-row
type=
"flex"
justify=
"center"
>
<el-col
:span=
"20"
>
<el-col
:span=
"20"
>
<el-form-item>
<el-form-item
prop=
"remark"
>
<el-input
v-model=
"form.remark"
<el-input
v-model=
"form.remark"
:autosize=
"{ minRows: 2, maxRows: 4}"
:autosize=
"{ minRows: 2, maxRows: 4}"
type=
"textarea"
type=
"textarea"
...
@@ -177,7 +178,7 @@
...
@@ -177,7 +178,7 @@
<
template
v-slot:footer
>
<
template
v-slot:footer
>
<el-switch
<el-switch
v-model=
"isCreateContinue"
v-model=
"isCreateContinue"
active-text=
"保存并继续创建
"
>
:active-text=
"$t('test_track.case.save_create_continue')
"
>
</el-switch>
</el-switch>
<ms-dialog-footer
v-if=
"!readOnly"
<ms-dialog-footer
v-if=
"!readOnly"
@
cancel=
"dialogFormVisible = false"
@
cancel=
"dialogFormVisible = false"
...
@@ -231,7 +232,8 @@
...
@@ -231,7 +232,8 @@
maintainer
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_maintainer
'
),
trigger
:
'
change
'
}],
maintainer
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_maintainer
'
),
trigger
:
'
change
'
}],
priority
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_priority
'
),
trigger
:
'
change
'
}],
priority
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_priority
'
),
trigger
:
'
change
'
}],
type
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_type
'
),
trigger
:
'
change
'
}],
type
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_type
'
),
trigger
:
'
change
'
}],
method
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_method
'
),
trigger
:
'
change
'
}]
method
:[{
required
:
true
,
message
:
this
.
$t
(
'
test_track.case.input_method
'
),
trigger
:
'
change
'
}],
remark
:[{
max
:
300
,
message
:
this
.
$t
(
'
test_track.length_less_than
'
)
+
'
300
'
,
trigger
:
'
blur
'
}]
},
},
formLabelWidth
:
"
120px
"
,
formLabelWidth
:
"
120px
"
,
operationType
:
''
,
operationType
:
''
,
...
@@ -296,7 +298,7 @@
...
@@ -296,7 +298,7 @@
step
.
num
++
;
step
.
num
++
;
}
}
});
});
this
.
form
.
steps
.
push
(
step
);
this
.
form
.
steps
.
splice
(
index
+
1
,
0
,
step
);
},
},
handleDeleteStep
(
index
,
data
)
{
handleDeleteStep
(
index
,
data
)
{
this
.
form
.
steps
.
splice
(
index
,
1
);
this
.
form
.
steps
.
splice
(
index
,
1
);
...
@@ -311,6 +313,15 @@
...
@@ -311,6 +313,15 @@
if
(
valid
)
{
if
(
valid
)
{
let
param
=
{};
let
param
=
{};
Object
.
assign
(
param
,
this
.
form
);
Object
.
assign
(
param
,
this
.
form
);
for
(
let
i
=
0
;
i
<
param
.
steps
.
length
;
i
++
){
if
(
param
.
steps
[
i
].
desc
.
length
>
300
||
param
.
steps
[
i
].
result
.
length
>
300
)
{
this
.
$warning
(
this
.
$t
(
'
test_track.case.step_desc
'
)
+
"
,
"
+
this
.
$t
(
'
test_track.case.expected_results
'
)
+
this
.
$t
(
'
test_track.length_less_than
'
)
+
'
300
'
);
return
;
}
}
param
.
steps
=
JSON
.
stringify
(
this
.
form
.
steps
);
param
.
steps
=
JSON
.
stringify
(
this
.
form
.
steps
);
param
.
nodeId
=
this
.
form
.
module
;
param
.
nodeId
=
this
.
form
.
module
;
this
.
moduleOptions
.
forEach
(
item
=>
{
this
.
moduleOptions
.
forEach
(
item
=>
{
...
...
frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue
浏览文件 @
94dd8372
...
@@ -222,12 +222,19 @@
...
@@ -222,12 +222,19 @@
param
.
id
=
this
.
testCase
.
id
;
param
.
id
=
this
.
testCase
.
id
;
param
.
status
=
this
.
testCase
.
status
;
param
.
status
=
this
.
testCase
.
status
;
param
.
results
=
[];
param
.
results
=
[];
this
.
testCase
.
steptResults
.
forEach
(
item
=>
{
for
(
let
i
=
0
;
i
<
this
.
testCase
.
steptResults
.
length
;
i
++
){
let
result
=
{};
let
result
=
{};
result
.
actualResult
=
item
.
actualResult
;
result
.
actualResult
=
this
.
testCase
.
steptResults
[
i
].
actualResult
;
result
.
executeResult
=
item
.
executeResult
;
result
.
executeResult
=
this
.
testCase
.
steptResults
[
i
].
executeResult
;
if
(
result
.
actualResult
&&
result
.
actualResult
.
length
>
300
)
{
this
.
$warning
(
this
.
$t
(
'
test_track.plan_view.actual_result
'
)
+
this
.
$t
(
'
test_track.length_less_than
'
)
+
'
300
'
);
return
;
}
param
.
results
.
push
(
result
);
param
.
results
.
push
(
result
);
});
}
param
.
results
=
JSON
.
stringify
(
param
.
results
);
param
.
results
=
JSON
.
stringify
(
param
.
results
);
param
.
issues
=
JSON
.
stringify
(
this
.
testCase
.
issues
);
param
.
issues
=
JSON
.
stringify
(
this
.
testCase
.
issues
);
this
.
$post
(
'
/test/plan/case/edit
'
,
param
,
()
=>
{
this
.
$post
(
'
/test/plan/case/edit
'
,
param
,
()
=>
{
...
...
frontend/src/i18n/en-US.js
浏览文件 @
94dd8372
...
@@ -375,6 +375,7 @@ export default {
...
@@ -375,6 +375,7 @@ export default {
input_prerequisite
:
"
Please select prerequisite
"
,
input_prerequisite
:
"
Please select prerequisite
"
,
delete_confirm
:
"
Confirm delete test case
"
,
delete_confirm
:
"
Confirm delete test case
"
,
delete
:
"
Delete case
"
,
delete
:
"
Delete case
"
,
save_create_continue
:
"
Save and create continue
"
,
import
:
{
import
:
{
import
:
"
Import test case
"
,
import
:
"
Import test case
"
,
case_import
:
"
Import test case
"
,
case_import
:
"
Import test case
"
,
...
...
frontend/src/i18n/zh-CN.js
浏览文件 @
94dd8372
...
@@ -372,6 +372,7 @@ export default {
...
@@ -372,6 +372,7 @@ export default {
input_prerequisite
:
"
请输入前置条件
"
,
input_prerequisite
:
"
请输入前置条件
"
,
delete_confirm
:
"
确认删除测试用例
"
,
delete_confirm
:
"
确认删除测试用例
"
,
delete
:
"
删除用例
"
,
delete
:
"
删除用例
"
,
save_create_continue
:
"
保存并继续创建
"
,
import
:
{
import
:
{
import
:
"
导入用例
"
,
import
:
"
导入用例
"
,
case_import
:
"
导入测试用例
"
,
case_import
:
"
导入测试用例
"
,
...
...
frontend/src/i18n/zh-TW.js
浏览文件 @
94dd8372
...
@@ -366,6 +366,7 @@ export default {
...
@@ -366,6 +366,7 @@ export default {
input_prerequisite
:
"
請輸入前置條件
"
,
input_prerequisite
:
"
請輸入前置條件
"
,
delete_confirm
:
"
確認刪除測試用例:
"
,
delete_confirm
:
"
確認刪除測試用例:
"
,
delete
:
"
删除用例
"
,
delete
:
"
删除用例
"
,
save_create_continue
:
"
保存並繼續創建
"
,
import
:
{
import
:
{
import
:
"
導入用例
"
,
import
:
"
導入用例
"
,
case_import
:
"
導入測試用例
"
,
case_import
:
"
導入測試用例
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录