Merge remote-tracking branch 'origin/master' into master
# Conflicts: # backend/src/main/java/io/metersphere/xpack
This commit is contained in:
commit
da6b3382ff
|
@ -11,5 +11,6 @@ public class ApiTestCaseResult extends ApiTestCaseWithBLOBs {
|
||||||
private String createUser;
|
private String createUser;
|
||||||
private String updateUser;
|
private String updateUser;
|
||||||
private String execResult;
|
private String execResult;
|
||||||
|
private Long execTime;
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,11 +220,11 @@ public class APIReportService {
|
||||||
if(firstTime==null || lastTime == null){
|
if(firstTime==null || lastTime == null){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
return apiTestReportMapper.countByProjectIDAndCreateInThisWeek(workspaceID,group,firstTime.getTime(),lastTime.getTime());
|
return extApiTestReportMapper.countByProjectIDAndCreateInThisWeek(workspaceID,group,firstTime.getTime(),lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countByWorkspaceIdAndGroup(String workspaceID, String group) {
|
public long countByWorkspaceIdAndGroup(String workspaceID, String group) {
|
||||||
return apiTestReportMapper.countByWorkspaceIdAndGroup(workspaceID,group);
|
return extApiTestReportMapper.countByWorkspaceIdAndGroup(workspaceID,group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,7 +357,7 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countScenarioByProjectID(String projectId) {
|
public long countScenarioByProjectID(String projectId) {
|
||||||
return apiScenarioMapper.countByProjectID(projectId);
|
return extApiScenarioMapper.countByProjectID(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countScenarioByProjectIDAndCreatInThisWeek(String projectId) {
|
public long countScenarioByProjectIDAndCreatInThisWeek(String projectId) {
|
||||||
|
@ -369,7 +369,7 @@ public class ApiAutomationService {
|
||||||
if(firstTime==null || lastTime == null){
|
if(firstTime==null || lastTime == null){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
return apiScenarioMapper.countByProjectIDAndCreatInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
return extApiScenarioMapper.countByProjectIDAndCreatInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class ApiDefinitionExecResultService {
|
||||||
extApiDefinitionExecResultMapper.deleteByResourceId(item.getName());
|
extApiDefinitionExecResultMapper.deleteByResourceId(item.getName());
|
||||||
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
|
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
|
||||||
saveResult.setId(UUID.randomUUID().toString());
|
saveResult.setId(UUID.randomUUID().toString());
|
||||||
|
saveResult.setCreateTime(System.currentTimeMillis());
|
||||||
saveResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
saveResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||||
saveResult.setName(item.getName());
|
saveResult.setName(item.getName());
|
||||||
saveResult.setResourceId(item.getName());
|
saveResult.setResourceId(item.getName());
|
||||||
|
@ -49,12 +50,12 @@ public class ApiDefinitionExecResultService {
|
||||||
if(firstTime==null || lastTime == null){
|
if(firstTime==null || lastTime == null){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
return apiDefinitionExecResultMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
return extApiDefinitionExecResultMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countByTestCaseIDInProject(String projectId) {
|
public long countByTestCaseIDInProject(String projectId) {
|
||||||
return apiDefinitionExecResultMapper.countByTestCaseIDInProject(projectId);
|
return extApiDefinitionExecResultMapper.countByTestCaseIDInProject(projectId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ public class ApiDefinitionExecResultService {
|
||||||
if(startTime==null){
|
if(startTime==null){
|
||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
}else {
|
}else {
|
||||||
return apiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId,startTime.getTime(),limitNumber);
|
return extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId,startTime.getTime(),limitNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,6 +283,7 @@ public class ApiDefinitionService {
|
||||||
createBodyFiles(bodyUploadIds, bodyFiles);
|
createBodyFiles(bodyUploadIds, bodyFiles);
|
||||||
|
|
||||||
HashTree hashTree = request.getTestElement().generateHashTree();
|
HashTree hashTree = request.getTestElement().generateHashTree();
|
||||||
|
request.getTestElement().getJmx(hashTree);
|
||||||
// 调用执行方法
|
// 调用执行方法
|
||||||
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.DELIMIT.name());
|
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.DELIMIT.name());
|
||||||
return request.getId();
|
return request.getId();
|
||||||
|
@ -389,7 +390,7 @@ public class ApiDefinitionService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
|
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
|
||||||
return apiDefinitionMapper.countProtocolByProjectID(projectId);
|
return extApiDefinitionMapper.countProtocolByProjectID(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -406,7 +407,7 @@ public class ApiDefinitionService {
|
||||||
if(firstTime==null || lastTime == null){
|
if(firstTime==null || lastTime == null){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
return apiDefinitionMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
return extApiDefinitionMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class ApiScenarioReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countByProjectID(String projectId) {
|
public long countByProjectID(String projectId) {
|
||||||
return apiScenarioReportMapper.countByProjectID(projectId);
|
return extApiScenarioReportMapper.countByProjectID(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countByProjectIDAndCreateInThisWeek(String projectId) {
|
public long countByProjectIDAndCreateInThisWeek(String projectId) {
|
||||||
|
@ -221,7 +221,7 @@ public class ApiScenarioReportService {
|
||||||
if(firstTime==null || lastTime == null){
|
if(firstTime==null || lastTime == null){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
return apiScenarioReportMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
return extApiScenarioReportMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class ApiTestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
|
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
|
||||||
return apiTestCaseMapper.countProtocolByProjectID(projectId);
|
return extApiTestCaseMapper.countProtocolByProjectID(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countByProjectIDAndCreateInThisWeek(String projectId) {
|
public long countByProjectIDAndCreateInThisWeek(String projectId) {
|
||||||
|
@ -261,7 +261,7 @@ public class ApiTestCaseService {
|
||||||
if(firstTime==null || lastTime == null){
|
if(firstTime==null || lastTime == null){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
return apiTestCaseMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
return extApiTestCaseMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ApiDefinitionExecResult implements Serializable {
|
public class ApiDefinitionExecResult implements Serializable {
|
||||||
|
@ -20,6 +19,8 @@ public class ApiDefinitionExecResult implements Serializable {
|
||||||
|
|
||||||
private Long endTime;
|
private Long endTime;
|
||||||
|
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -573,6 +573,66 @@ public class ApiDefinitionExecResultExample {
|
||||||
addCriterion("end_time not between", value1, value2, "endTime");
|
addCriterion("end_time not between", value1, value2, "endTime");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeIsNull() {
|
||||||
|
addCriterion("create_time is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeIsNotNull() {
|
||||||
|
addCriterion("create_time is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeEqualTo(Long value) {
|
||||||
|
addCriterion("create_time =", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeNotEqualTo(Long value) {
|
||||||
|
addCriterion("create_time <>", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeGreaterThan(Long value) {
|
||||||
|
addCriterion("create_time >", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("create_time >=", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeLessThan(Long value) {
|
||||||
|
addCriterion("create_time <", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("create_time <=", value, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeIn(List<Long> values) {
|
||||||
|
addCriterion("create_time in", values, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeNotIn(List<Long> values) {
|
||||||
|
addCriterion("create_time not in", values, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("create_time between", value1, value2, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("create_time not between", value1, value2, "createTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface ApiDefinitionExecResultMapper {
|
public interface ApiDefinitionExecResultMapper {
|
||||||
long countByExample(ApiDefinitionExecResultExample example);
|
long countByExample(ApiDefinitionExecResultExample example);
|
||||||
|
@ -37,41 +38,4 @@ public interface ApiDefinitionExecResultMapper {
|
||||||
|
|
||||||
int updateByPrimaryKey(ApiDefinitionExecResult record);
|
int updateByPrimaryKey(ApiDefinitionExecResult record);
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT count(id) AS countNumber FROM api_definition_exec_result ",
|
|
||||||
"WHERE resource_id IN ( ",
|
|
||||||
"SELECT testCase.id FROM api_test_case testCase ",
|
|
||||||
"WHERE testCase.project_id = #{projectId}) ",
|
|
||||||
"and start_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
|
||||||
})
|
|
||||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT count(id) AS countNumber FROM api_definition_exec_result ",
|
|
||||||
"WHERE resource_id IN ( ",
|
|
||||||
"SELECT testCase.id FROM api_test_case testCase ",
|
|
||||||
"WHERE testCase.project_id = #{projectId}) ",
|
|
||||||
})
|
|
||||||
long countByTestCaseIDInProject(String projectId);
|
|
||||||
|
|
||||||
// AS testPlan FROM ( SELECT apiCase.id AS testCaseID,apiCase.`name` AS testCaseNa' at line 1
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes FROM ( ",
|
|
||||||
"SELECT apiCase.id AS testCaseID,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName FROM api_test_case apiCase ",
|
|
||||||
"LEFT JOIN test_plan testPlan ON testPlan.api_ids like concat('%\"',apiCase.id,'\"%') ",
|
|
||||||
"GROUP BY apiCase.id ",
|
|
||||||
"ORDER BY apiCase.create_time DESC ",
|
|
||||||
")testCase ",
|
|
||||||
"INNER JOIN ( ",
|
|
||||||
"SELECT resource_id AS testCaseID,COUNT(id) AS dataCountNumber,start_time AS executeTime FROM api_definition_exec_result ",
|
|
||||||
"WHERE resource_id IN ( ",
|
|
||||||
"SELECT id FROM api_test_case WHERE project_id = #{projectId} ",
|
|
||||||
") and `status` = 'error' GROUP BY resource_id ",
|
|
||||||
") caseErrorCountData ON caseErrorCountData.testCaseID =testCase.testCaseID ",
|
|
||||||
"WHERE caseErrorCountData.executeTime >= #{startTimestamp} ",
|
|
||||||
"ORDER BY caseErrorCountData.dataCountNumber DESC ",
|
|
||||||
"limit #{limitNumber} "
|
|
||||||
})
|
|
||||||
List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp, @Param("limitNumber") int limitNumber);
|
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||||
<result column="start_time" jdbcType="BIGINT" property="startTime" />
|
<result column="start_time" jdbcType="BIGINT" property="startTime" />
|
||||||
<result column="end_time" jdbcType="BIGINT" property="endTime" />
|
<result column="end_time" jdbcType="BIGINT" property="endTime" />
|
||||||
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionExecResult">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||||
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
||||||
|
@ -72,7 +73,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, `name`, resource_id, `status`, user_id, start_time, end_time
|
id, `name`, resource_id, `status`, user_id, start_time, end_time, create_time
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
content
|
content
|
||||||
|
@ -128,10 +129,12 @@
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||||
insert into api_definition_exec_result (id, `name`, resource_id,
|
insert into api_definition_exec_result (id, `name`, resource_id,
|
||||||
`status`, user_id, start_time,
|
`status`, user_id, start_time,
|
||||||
end_time, content)
|
end_time, create_time, content
|
||||||
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
|
||||||
#{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
|
#{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
|
||||||
#{endTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
|
#{endTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}
|
||||||
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||||
insert into api_definition_exec_result
|
insert into api_definition_exec_result
|
||||||
|
@ -157,6 +160,9 @@
|
||||||
<if test="endTime != null">
|
<if test="endTime != null">
|
||||||
end_time,
|
end_time,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
content,
|
content,
|
||||||
</if>
|
</if>
|
||||||
|
@ -183,6 +189,9 @@
|
||||||
<if test="endTime != null">
|
<if test="endTime != null">
|
||||||
#{endTime,jdbcType=BIGINT},
|
#{endTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
#{content,jdbcType=LONGVARCHAR},
|
#{content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -218,6 +227,9 @@
|
||||||
<if test="record.endTime != null">
|
<if test="record.endTime != null">
|
||||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="record.content != null">
|
<if test="record.content != null">
|
||||||
content = #{record.content,jdbcType=LONGVARCHAR},
|
content = #{record.content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -235,6 +247,7 @@
|
||||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||||
start_time = #{record.startTime,jdbcType=BIGINT},
|
start_time = #{record.startTime,jdbcType=BIGINT},
|
||||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||||
|
create_time = #{record.createTime,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" />
|
||||||
|
@ -248,7 +261,8 @@
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||||
start_time = #{record.startTime,jdbcType=BIGINT},
|
start_time = #{record.startTime,jdbcType=BIGINT},
|
||||||
end_time = #{record.endTime,jdbcType=BIGINT}
|
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||||
|
create_time = #{record.createTime,jdbcType=BIGINT}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -274,6 +288,9 @@
|
||||||
<if test="endTime != null">
|
<if test="endTime != null">
|
||||||
end_time = #{endTime,jdbcType=BIGINT},
|
end_time = #{endTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
content = #{content,jdbcType=LONGVARCHAR},
|
content = #{content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -288,6 +305,7 @@
|
||||||
user_id = #{userId,jdbcType=VARCHAR},
|
user_id = #{userId,jdbcType=VARCHAR},
|
||||||
start_time = #{startTime,jdbcType=BIGINT},
|
start_time = #{startTime,jdbcType=BIGINT},
|
||||||
end_time = #{endTime,jdbcType=BIGINT},
|
end_time = #{endTime,jdbcType=BIGINT},
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
content = #{content,jdbcType=LONGVARCHAR}
|
content = #{content,jdbcType=LONGVARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
@ -298,7 +316,8 @@
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
user_id = #{userId,jdbcType=VARCHAR},
|
user_id = #{userId,jdbcType=VARCHAR},
|
||||||
start_time = #{startTime,jdbcType=BIGINT},
|
start_time = #{startTime,jdbcType=BIGINT},
|
||||||
end_time = #{endTime,jdbcType=BIGINT}
|
end_time = #{endTime,jdbcType=BIGINT},
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -39,13 +39,4 @@ public interface ApiDefinitionMapper {
|
||||||
|
|
||||||
int updateByPrimaryKey(ApiDefinition record);
|
int updateByPrimaryKey(ApiDefinition record);
|
||||||
|
|
||||||
@Select("SELECT protocol AS groupField,count(id) AS countNumber FROM api_definition WHERE project_id = #{0} GROUP BY protocol;")
|
|
||||||
List<ApiDataCountResult> countProtocolByProjectID(String projectId);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT count(id) AS countNumber FROM api_definition ",
|
|
||||||
"WHERE project_id = #{projectId} ",
|
|
||||||
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
|
||||||
})
|
|
||||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
|
||||||
}
|
}
|
|
@ -35,13 +35,4 @@ public interface ApiScenarioMapper {
|
||||||
|
|
||||||
int updateByPrimaryKey(ApiScenario record);
|
int updateByPrimaryKey(ApiScenario record);
|
||||||
|
|
||||||
@Select("SELECT COUNT(id) AS countNumber FROM api_scenario WHERE project_id = #{0} ")
|
|
||||||
long countByProjectID(String projectId);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT count(id) AS countNumber FROM api_scenario ",
|
|
||||||
"WHERE project_id = #{projectId} ",
|
|
||||||
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
|
||||||
})
|
|
||||||
long countByProjectIDAndCreatInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
|
||||||
}
|
}
|
|
@ -29,13 +29,4 @@ public interface ApiScenarioReportMapper {
|
||||||
|
|
||||||
int updateByPrimaryKey(ApiScenarioReport record);
|
int updateByPrimaryKey(ApiScenarioReport record);
|
||||||
|
|
||||||
@Select("SELECT count(id) AS countNumber FROM api_scenario_report WHERE project_id = #{0} ")
|
|
||||||
long countByProjectID(String projectId);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT count(id) AS countNumber FROM api_scenario_report ",
|
|
||||||
"WHERE project_id = #{projectId} ",
|
|
||||||
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
|
||||||
})
|
|
||||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
|
||||||
}
|
}
|
|
@ -38,19 +38,4 @@ public interface ApiTestCaseMapper {
|
||||||
|
|
||||||
int updateByPrimaryKey(ApiTestCase record);
|
int updateByPrimaryKey(ApiTestCase record);
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT apiDef.protocol AS groupField,COUNT(testCase.id) AS countNumber FROM api_test_case testCase ",
|
|
||||||
"INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id ",
|
|
||||||
"WHERE testCase.project_id = #{0} ",
|
|
||||||
"GROUP BY apiDef.protocol "
|
|
||||||
})
|
|
||||||
List<ApiDataCountResult> countProtocolByProjectID(String projectId);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT count(testCase.id) AS countNumber FROM api_test_case testCase ",
|
|
||||||
"INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id ",
|
|
||||||
"WHERE testCase.project_id = #{projectId} ",
|
|
||||||
"AND testCase.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
|
||||||
})
|
|
||||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
|
||||||
}
|
}
|
|
@ -29,20 +29,4 @@ public interface ApiTestReportMapper {
|
||||||
|
|
||||||
int updateByPrimaryKey(ApiTestReport record);
|
int updateByPrimaryKey(ApiTestReport record);
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT COUNT(testReportDetail.report_id) AS countNumber FROM api_test_report_detail testReportDetail ",
|
|
||||||
"INNER JOIN `schedule` sch ON sch.resource_id = testReportDetail.test_id ",
|
|
||||||
"INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id ",
|
|
||||||
"WHERE workspace_id = #{workspaceID} AND `group` = #{group} ",
|
|
||||||
})
|
|
||||||
long countByWorkspaceIdAndGroup(@Param("workspaceID") String workspaceID, @Param("group")String group);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT COUNT(testReportDetail.report_id) AS countNumber FROM api_test_report_detail testReportDetail ",
|
|
||||||
"INNER JOIN `schedule` sch ON sch.resource_id = testReportDetail.test_id ",
|
|
||||||
"INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id ",
|
|
||||||
"WHERE workspace_id = #{workspaceID} AND `group` = #{group} ",
|
|
||||||
"AND testReport.create_time BETWEEN #{startTime} and #{endTime} ",
|
|
||||||
})
|
|
||||||
long countByProjectIDAndCreateInThisWeek(@Param("workspaceID") String workspaceID, @Param("group")String group, @Param("startTime") long startTime, @Param("endTime")long endTime);
|
|
||||||
}
|
}
|
|
@ -38,24 +38,4 @@ public interface ScheduleMapper {
|
||||||
|
|
||||||
int updateByPrimaryKey(Schedule record);
|
int updateByPrimaryKey(Schedule record);
|
||||||
|
|
||||||
@Select("SELECT COUNT(id) AS countNumber FROM `schedule` WHERE `workspace_id` = #{workspaceId} AND `group` = #{group} ")
|
|
||||||
long countTaskByWorkspaceIdAndGroup(@Param("workspaceId") String workspaceId,@Param("group") String group);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT COUNT(id) AS countNumber FROM `schedule` ",
|
|
||||||
"WHERE workspace_id = #{workspaceId} ",
|
|
||||||
"AND `group` = #{group} ",
|
|
||||||
"AND create_time BETWEEN #{startTime} and #{endTime}; "
|
|
||||||
})
|
|
||||||
long countTaskByWorkspaceIdAndGroupAndCreateTimeRange(@Param("workspaceId")String workspaceId,@Param("group") String group, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
|
||||||
|
|
||||||
@Select({
|
|
||||||
"SELECT apiTest.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime ",
|
|
||||||
"FROM api_test apiTest ",
|
|
||||||
"INNER JOIN `schedule` sch ON apiTest.id = sch.resource_id ",
|
|
||||||
"INNER JOIN `user` u ON u.id = sch.user_id ",
|
|
||||||
"WHERE sch.`enable` = true AND sch.workspace_id = #{0,jdbcType=VARCHAR}"
|
|
||||||
})
|
|
||||||
List<TaskInfoResult> findRunningTaskInfoByWorkspaceID(String workspaceID);
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,11 @@
|
||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.api.dto.dataCount.ExecutedCaseInfoResult;
|
||||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ExtApiDefinitionExecResultMapper {
|
public interface ExtApiDefinitionExecResultMapper {
|
||||||
|
|
||||||
|
@ -8,4 +13,40 @@ public interface ExtApiDefinitionExecResultMapper {
|
||||||
|
|
||||||
ApiDefinitionExecResult selectMaxResultByResourceId(String resourceId);
|
ApiDefinitionExecResult selectMaxResultByResourceId(String resourceId);
|
||||||
|
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT count(id) AS countNumber FROM api_definition_exec_result ",
|
||||||
|
"WHERE resource_id IN ( ",
|
||||||
|
"SELECT testCase.id FROM api_test_case testCase ",
|
||||||
|
"WHERE testCase.project_id = #{projectId}) ",
|
||||||
|
"and start_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||||
|
})
|
||||||
|
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT count(id) AS countNumber FROM api_definition_exec_result ",
|
||||||
|
"WHERE resource_id IN ( ",
|
||||||
|
"SELECT testCase.id FROM api_test_case testCase ",
|
||||||
|
"WHERE testCase.project_id = #{projectId}) ",
|
||||||
|
})
|
||||||
|
long countByTestCaseIDInProject(String projectId);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes FROM ( ",
|
||||||
|
"SELECT apiCase.id AS testCaseID,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName FROM api_test_case apiCase ",
|
||||||
|
"LEFT JOIN test_plan testPlan ON testPlan.api_ids like concat('%\"',apiCase.id,'\"%') ",
|
||||||
|
"GROUP BY apiCase.id ",
|
||||||
|
"ORDER BY apiCase.create_time DESC ",
|
||||||
|
")testCase ",
|
||||||
|
"INNER JOIN ( ",
|
||||||
|
"SELECT resource_id AS testCaseID,COUNT(id) AS dataCountNumber,start_time AS executeTime FROM api_definition_exec_result ",
|
||||||
|
"WHERE resource_id IN ( ",
|
||||||
|
"SELECT id FROM api_test_case WHERE project_id = #{projectId} ",
|
||||||
|
") and `status` = 'error' GROUP BY resource_id ",
|
||||||
|
") caseErrorCountData ON caseErrorCountData.testCaseID =testCase.testCaseID ",
|
||||||
|
"WHERE caseErrorCountData.executeTime >= #{startTimestamp} ",
|
||||||
|
"ORDER BY caseErrorCountData.dataCountNumber DESC ",
|
||||||
|
"limit #{limitNumber} "
|
||||||
|
})
|
||||||
|
List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp, @Param("limitNumber") int limitNumber);
|
||||||
}
|
}
|
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
<select id="selectMaxResultByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
<select id="selectMaxResultByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||||
select * from api_definition_exec_result
|
select * from api_definition_exec_result
|
||||||
where resource_id = #{resourceId,jdbcType=VARCHAR} ORDER BY start_time DESC LIMIT 1
|
where resource_id = #{resourceId,jdbcType=VARCHAR} ORDER BY create_time DESC LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,9 +1,11 @@
|
||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||||
import io.metersphere.api.dto.definition.ApiComputeResult;
|
import io.metersphere.api.dto.definition.ApiComputeResult;
|
||||||
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
|
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
|
||||||
import io.metersphere.api.dto.definition.ApiDefinitionResult;
|
import io.metersphere.api.dto.definition.ApiDefinitionResult;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -17,4 +19,13 @@ public interface ExtApiDefinitionMapper {
|
||||||
|
|
||||||
int reduction(@Param("ids") List<String> ids);
|
int reduction(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
@Select("SELECT protocol AS groupField,count(id) AS countNumber FROM api_definition WHERE project_id = #{0} GROUP BY protocol;")
|
||||||
|
List<ApiDataCountResult> countProtocolByProjectID(String projectId);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT count(id) AS countNumber FROM api_definition ",
|
||||||
|
"WHERE project_id = #{projectId} ",
|
||||||
|
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||||
|
})
|
||||||
|
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||||
}
|
}
|
|
@ -94,20 +94,16 @@
|
||||||
when 'error' then '未通过'
|
when 'error' then '未通过'
|
||||||
ELSE '未执行' end as status ,
|
ELSE '未执行' end as status ,
|
||||||
CONCAT(FORMAT(SUM(IF(t2.`status` = 'success', 1, 0))/ COUNT(t1.id)*100, 2), '%') passRate
|
CONCAT(FORMAT(SUM(IF(t2.`status` = 'success', 1, 0))/ COUNT(t1.id)*100, 2), '%') passRate
|
||||||
from api_test_case t1 left join (
|
from api_test_case t1
|
||||||
select
|
|
||||||
a.status, a.id, a.resource_id
|
|
||||||
from
|
|
||||||
api_definition_exec_result a
|
|
||||||
left join (
|
left join (
|
||||||
select
|
select
|
||||||
max(start_time) start_time , id, resource_id
|
max(create_time) create_time ,status ,id, resource_id
|
||||||
from
|
from
|
||||||
api_definition_exec_result
|
api_definition_exec_result
|
||||||
group by
|
group by
|
||||||
resource_id ) as b on a.id = b.id
|
resource_id
|
||||||
where
|
)as t2
|
||||||
a.start_time = b.start_time)as t2 on t1.id = t2.resource_id
|
on t1.id = t2.resource_id
|
||||||
group by t1.api_definition_id having t1.api_definition_id in
|
group by t1.api_definition_id having t1.api_definition_id in
|
||||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||||
#{v}
|
#{v}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
||||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||||
import io.metersphere.base.domain.ApiScenario;
|
import io.metersphere.base.domain.ApiScenario;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -19,4 +20,14 @@ public interface ExtApiScenarioMapper {
|
||||||
int removeToGc(@Param("ids") List<String> ids);
|
int removeToGc(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
int reduction(@Param("ids") List<String> ids);
|
int reduction(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(id) AS countNumber FROM api_scenario WHERE project_id = #{0} ")
|
||||||
|
long countByProjectID(String projectId);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT count(id) AS countNumber FROM api_scenario ",
|
||||||
|
"WHERE project_id = #{projectId} ",
|
||||||
|
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||||
|
})
|
||||||
|
long countByProjectIDAndCreatInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import io.metersphere.api.dto.APIReportResult;
|
||||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -12,4 +13,14 @@ public interface ExtApiScenarioReportMapper {
|
||||||
|
|
||||||
APIReportResult get(@Param("reportId") String reportId);
|
APIReportResult get(@Param("reportId") String reportId);
|
||||||
|
|
||||||
|
@Select("SELECT count(id) AS countNumber FROM api_scenario_report WHERE project_id = #{0} ")
|
||||||
|
long countByProjectID(String projectId);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT count(id) AS countNumber FROM api_scenario_report ",
|
||||||
|
"WHERE project_id = #{projectId} ",
|
||||||
|
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||||
|
})
|
||||||
|
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||||
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
|
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
|
||||||
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||||
import io.metersphere.api.dto.definition.ApiTestCaseResult;
|
import io.metersphere.api.dto.definition.ApiTestCaseResult;
|
||||||
import io.metersphere.base.domain.ApiTestCase;
|
import io.metersphere.base.domain.ApiTestCase;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -12,4 +14,20 @@ public interface ExtApiTestCaseMapper {
|
||||||
|
|
||||||
List<ApiTestCaseResult> list(@Param("request") ApiTestCaseRequest request);
|
List<ApiTestCaseResult> list(@Param("request") ApiTestCaseRequest request);
|
||||||
List<ApiTestCaseDTO> listSimple(@Param("request") ApiTestCaseRequest request);
|
List<ApiTestCaseDTO> listSimple(@Param("request") ApiTestCaseRequest request);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT apiDef.protocol AS groupField,COUNT(testCase.id) AS countNumber FROM api_test_case testCase ",
|
||||||
|
"INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id ",
|
||||||
|
"WHERE testCase.project_id = #{0} ",
|
||||||
|
"GROUP BY apiDef.protocol "
|
||||||
|
})
|
||||||
|
List<ApiDataCountResult> countProtocolByProjectID(String projectId);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT count(testCase.id) AS countNumber FROM api_test_case testCase ",
|
||||||
|
"INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id ",
|
||||||
|
"WHERE testCase.project_id = #{projectId} ",
|
||||||
|
"AND testCase.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||||
|
})
|
||||||
|
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||||
}
|
}
|
|
@ -161,7 +161,8 @@
|
||||||
atc.create_time,
|
atc.create_time,
|
||||||
atc.update_user_id,
|
atc.update_user_id,
|
||||||
atc.update_time,
|
atc.update_time,
|
||||||
ader.status execResult
|
ader.status execResult,
|
||||||
|
ader.create_time execTime
|
||||||
from
|
from
|
||||||
api_test_case atc
|
api_test_case atc
|
||||||
left join user u1 on
|
left join user u1 on
|
||||||
|
@ -170,18 +171,11 @@
|
||||||
atc.update_user_id = u2.id
|
atc.update_user_id = u2.id
|
||||||
left join (
|
left join (
|
||||||
select
|
select
|
||||||
a.status, a.id, a.resource_id
|
max(create_time) create_time ,status ,id, resource_id
|
||||||
from
|
|
||||||
api_definition_exec_result a
|
|
||||||
left join (
|
|
||||||
select
|
|
||||||
max(start_time) start_time , id, resource_id
|
|
||||||
from
|
from
|
||||||
api_definition_exec_result
|
api_definition_exec_result
|
||||||
group by
|
group by
|
||||||
resource_id ) as b on a.id = b.id
|
resource_id) as ader
|
||||||
where
|
|
||||||
a.start_time = b.start_time) as ader
|
|
||||||
on atc.id = ader.resource_id
|
on atc.id = ader.resource_id
|
||||||
<where>
|
<where>
|
||||||
<if test="request.name != null and request.name!=''">
|
<if test="request.name != null and request.name!=''">
|
||||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||||
import io.metersphere.dto.ApiReportDTO;
|
import io.metersphere.dto.ApiReportDTO;
|
||||||
import io.metersphere.dto.DashboardTestDTO;
|
import io.metersphere.dto.DashboardTestDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -18,4 +19,21 @@ public interface ExtApiTestReportMapper {
|
||||||
|
|
||||||
List<DashboardTestDTO> selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp);
|
List<DashboardTestDTO> selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp);
|
||||||
|
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT COUNT(testReportDetail.report_id) AS countNumber FROM api_test_report_detail testReportDetail ",
|
||||||
|
"INNER JOIN `schedule` sch ON sch.resource_id = testReportDetail.test_id ",
|
||||||
|
"INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id ",
|
||||||
|
"WHERE workspace_id = #{workspaceID} AND `group` = #{group} ",
|
||||||
|
})
|
||||||
|
long countByWorkspaceIdAndGroup(@Param("workspaceID") String workspaceID, @Param("group")String group);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT COUNT(testReportDetail.report_id) AS countNumber FROM api_test_report_detail testReportDetail ",
|
||||||
|
"INNER JOIN `schedule` sch ON sch.resource_id = testReportDetail.test_id ",
|
||||||
|
"INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id ",
|
||||||
|
"WHERE workspace_id = #{workspaceID} AND `group` = #{group} ",
|
||||||
|
"AND testReport.create_time BETWEEN #{startTime} and #{endTime} ",
|
||||||
|
})
|
||||||
|
long countByProjectIDAndCreateInThisWeek(@Param("workspaceID") String workspaceID, @Param("group")String group, @Param("startTime") long startTime, @Param("endTime")long endTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,34 @@
|
||||||
package io.metersphere.base.mapper.ext;
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.api.dto.dataCount.response.TaskInfoResult;
|
||||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||||
import io.metersphere.dto.ScheduleDao;
|
import io.metersphere.dto.ScheduleDao;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface ExtScheduleMapper {
|
public interface ExtScheduleMapper {
|
||||||
List<ScheduleDao> list(@Param("request") QueryScheduleRequest request);
|
List<ScheduleDao> list(@Param("request") QueryScheduleRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(id) AS countNumber FROM `schedule` WHERE `workspace_id` = #{workspaceId} AND `group` = #{group} ")
|
||||||
|
long countTaskByWorkspaceIdAndGroup(@Param("workspaceId") String workspaceId,@Param("group") String group);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT COUNT(id) AS countNumber FROM `schedule` ",
|
||||||
|
"WHERE workspace_id = #{workspaceId} ",
|
||||||
|
"AND `group` = #{group} ",
|
||||||
|
"AND create_time BETWEEN #{startTime} and #{endTime}; "
|
||||||
|
})
|
||||||
|
long countTaskByWorkspaceIdAndGroupAndCreateTimeRange(@Param("workspaceId")String workspaceId,@Param("group") String group, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
||||||
|
|
||||||
|
@Select({
|
||||||
|
"SELECT apiTest.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime ",
|
||||||
|
"FROM api_test apiTest ",
|
||||||
|
"INNER JOIN `schedule` sch ON apiTest.id = sch.resource_id ",
|
||||||
|
"INNER JOIN `user` u ON u.id = sch.user_id ",
|
||||||
|
"WHERE sch.`enable` = true AND sch.workspace_id = #{0,jdbcType=VARCHAR}"
|
||||||
|
})
|
||||||
|
List<TaskInfoResult> findRunningTaskInfoByWorkspaceID(String workspaceID);
|
||||||
}
|
}
|
|
@ -167,7 +167,7 @@ public class ScheduleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countTaskByWorkspaceIdAndGroup(String workspaceId,String group) {
|
public long countTaskByWorkspaceIdAndGroup(String workspaceId,String group) {
|
||||||
return scheduleMapper.countTaskByWorkspaceIdAndGroup(workspaceId,group);
|
return extScheduleMapper.countTaskByWorkspaceIdAndGroup(workspaceId,group);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countTaskByWorkspaceIdAndGroupInThisWeek(String workspaceID, String group) {
|
public long countTaskByWorkspaceIdAndGroupInThisWeek(String workspaceID, String group) {
|
||||||
|
@ -179,12 +179,12 @@ public class ScheduleService {
|
||||||
if(firstTime==null || lastTime == null){
|
if(firstTime==null || lastTime == null){
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
return scheduleMapper.countTaskByWorkspaceIdAndGroupAndCreateTimeRange(workspaceID,group,firstTime.getTime(),lastTime.getTime());
|
return extScheduleMapper.countTaskByWorkspaceIdAndGroupAndCreateTimeRange(workspaceID,group,firstTime.getTime(),lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TaskInfoResult> findRunningTaskInfoByWorkspaceID(String workspaceID) {
|
public List<TaskInfoResult> findRunningTaskInfoByWorkspaceID(String workspaceID) {
|
||||||
List<TaskInfoResult> runningTaskInfoList = scheduleMapper.findRunningTaskInfoByWorkspaceID(workspaceID);
|
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByWorkspaceID(workspaceID);
|
||||||
return runningTaskInfoList;
|
return runningTaskInfoList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE api_definition_exec_result ADD create_time BIGINT(13) NULL;
|
|
@ -49,7 +49,7 @@
|
||||||
<div v-else> {{getResult(apiCase.execResult)}}</div>
|
<div v-else> {{getResult(apiCase.execResult)}}</div>
|
||||||
|
|
||||||
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
||||||
<span> {{apiCase.updateTime | timestampFormatDate }}</span>
|
<span> {{apiCase.execTime | timestampFormatDate }}</span>
|
||||||
{{apiCase.updateUser}}
|
{{apiCase.updateUser}}
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
|
@ -157,6 +157,7 @@
|
||||||
this.$emit('saveAsEdit', data);
|
this.$emit('saveAsEdit', data);
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
|
this.list();
|
||||||
this.$emit("refreshTable");
|
this.$emit("refreshTable");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
<el-col :span="14">
|
<el-col :span="14">
|
||||||
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
|
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
|
||||||
|
|
||||||
<el-menu-item :index="'/api/home'">
|
<el-menu-item v-show="$store.state.switch.value=='new'" :index="'/api/home'">
|
||||||
|
{{ $t("i18n.home") }}
|
||||||
|
</el-menu-item>
|
||||||
|
<el-menu-item v-show="$store.state.switch.value=='old'" :index="'/api/home_obsolete'">
|
||||||
{{ $t("i18n.home") }}
|
{{ $t("i18n.home") }}
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,8 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
|
||||||
/*color: #333;*/
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
/*line-height: 20;*/
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -50,7 +50,7 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
/*background-color: #D3DCE6;*/
|
||||||
/*color: #333;*/
|
/*color: #333;*/
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
/*background-color: #D3DCE6;*/
|
||||||
/*color: #333;*/
|
/*color: #333;*/
|
||||||
|
|
|
@ -50,7 +50,7 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
/*background-color: #D3DCE6;*/
|
||||||
/*color: #333;*/
|
/*color: #333;*/
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
/*background-color: #D3DCE6;*/
|
||||||
/*color: #333;*/
|
/*color: #333;*/
|
||||||
|
|
|
@ -58,7 +58,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
/*background-color: #D3DCE6;*/
|
||||||
/*color: #333;*/
|
/*color: #333;*/
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
/*background-color: #D3DCE6;*/
|
||||||
/*color: #333;*/
|
/*color: #333;*/
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
.el-aside {
|
.el-aside {
|
||||||
/*background-color: #D3DCE6;*/
|
/*background-color: #D3DCE6;*/
|
||||||
/*color: #333;*/
|
/*color: #333;*/
|
||||||
|
|
|
@ -11,9 +11,13 @@ export default {
|
||||||
{
|
{
|
||||||
path: 'home',
|
path: 'home',
|
||||||
name: 'fucHome',
|
name: 'fucHome',
|
||||||
// component: () => import('@/business/components/api/home/ApiTestHome'),
|
|
||||||
component: () => import('@/business/components/api/homepage/ApiTestHomePage'),
|
component: () => import('@/business/components/api/homepage/ApiTestHomePage'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'home_obsolete',
|
||||||
|
name: 'fucHome',
|
||||||
|
component: () => import('@/business/components/api/home/ApiTestHome'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "test/:type",
|
path: "test/:type",
|
||||||
name: "ApiTestConfig",
|
name: "ApiTestConfig",
|
||||||
|
|
|
@ -77,8 +77,13 @@
|
||||||
this.isReadOnly = !this.isReadOnly
|
this.isReadOnly = !this.isReadOnly
|
||||||
this.$store.commit('setFlag', this.isReadOnly);
|
this.$store.commit('setFlag', this.isReadOnly);
|
||||||
this.$store.commit('setValue', item);
|
this.$store.commit('setValue', item);
|
||||||
|
if(item=="old"){
|
||||||
|
window.location.href = "/#/api/home_obsolete";
|
||||||
|
}else {
|
||||||
window.location.href = "/#/api/home";
|
window.location.href = "/#/api/home";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -173,6 +173,10 @@ export default {
|
||||||
this.$warning(this.$t('test_track.case.input_name'));
|
this.$warning(this.$t('test_track.case.input_name'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (data.name.trim().length > 50) {
|
||||||
|
this.$warning(this.$t('test_track.length_less_than') + '50');
|
||||||
|
return;
|
||||||
|
}
|
||||||
let param = {};
|
let param = {};
|
||||||
this.buildSaveParam(param, node.parent.data, data);
|
this.buildSaveParam(param, node.parent.data, data);
|
||||||
if (param.type === 'edit') {
|
if (param.type === 'edit') {
|
||||||
|
|
Loading…
Reference in New Issue