refactor(任务中心): 任务中心数据记录补充资源id&计划id

This commit is contained in:
WangXu10 2024-11-12 16:25:49 +08:00 committed by Craftsman
parent c8b08735a5
commit ab848b47a7
19 changed files with 164 additions and 55 deletions

View File

@ -78,13 +78,16 @@ public class ExecTaskItem implements Serializable {
@Size(min = 1, max = 50, message = "{exec_task_item.executor.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{exec_task_item.executor.length_range}", groups = {Created.class, Updated.class})
private String executor; private String executor;
@Schema(description = "测试集ID")
private String collectionId;
@Schema(description = "删除标识", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "删除标识", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{exec_task_item.deleted.not_blank}", groups = {Created.class}) @NotNull(message = "{exec_task_item.deleted.not_blank}", groups = {Created.class})
private Boolean deleted; private Boolean deleted;
@Schema(description = "测试集ID")
private String collectionId;
@Schema(description = "用例表id")
private String caseId;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -104,8 +107,9 @@ public class ExecTaskItem implements Serializable {
startTime("start_time", "startTime", "BIGINT", false), startTime("start_time", "startTime", "BIGINT", false),
endTime("end_time", "endTime", "BIGINT", false), endTime("end_time", "endTime", "BIGINT", false),
executor("executor", "executor", "VARCHAR", false), executor("executor", "executor", "VARCHAR", false),
deleted("deleted", "deleted", "BIT", false),
collectionId("collection_id", "collectionId", "VARCHAR", false), collectionId("collection_id", "collectionId", "VARCHAR", false),
deleted("deleted", "deleted", "BIT", false); caseId("case_id", "caseId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -1204,6 +1204,66 @@ public class ExecTaskItemExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andCollectionIdIsNull() { public Criteria andCollectionIdIsNull() {
addCriterion("collection_id is null"); addCriterion("collection_id is null");
return (Criteria) this; return (Criteria) this;
@ -1274,63 +1334,73 @@ public class ExecTaskItemExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedIsNull() { public Criteria andCaseIdIsNull() {
addCriterion("deleted is null"); addCriterion("case_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedIsNotNull() { public Criteria andCaseIdIsNotNull() {
addCriterion("deleted is not null"); addCriterion("case_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedEqualTo(Boolean value) { public Criteria andCaseIdEqualTo(String value) {
addCriterion("deleted =", value, "deleted"); addCriterion("case_id =", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedNotEqualTo(Boolean value) { public Criteria andCaseIdNotEqualTo(String value) {
addCriterion("deleted <>", value, "deleted"); addCriterion("case_id <>", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedGreaterThan(Boolean value) { public Criteria andCaseIdGreaterThan(String value) {
addCriterion("deleted >", value, "deleted"); addCriterion("case_id >", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) { public Criteria andCaseIdGreaterThanOrEqualTo(String value) {
addCriterion("deleted >=", value, "deleted"); addCriterion("case_id >=", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedLessThan(Boolean value) { public Criteria andCaseIdLessThan(String value) {
addCriterion("deleted <", value, "deleted"); addCriterion("case_id <", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedLessThanOrEqualTo(Boolean value) { public Criteria andCaseIdLessThanOrEqualTo(String value) {
addCriterion("deleted <=", value, "deleted"); addCriterion("case_id <=", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedIn(List<Boolean> values) { public Criteria andCaseIdLike(String value) {
addCriterion("deleted in", values, "deleted"); addCriterion("case_id like", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedNotIn(List<Boolean> values) { public Criteria andCaseIdNotLike(String value) {
addCriterion("deleted not in", values, "deleted"); addCriterion("case_id not like", value, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedBetween(Boolean value1, Boolean value2) { public Criteria andCaseIdIn(List<String> values) {
addCriterion("deleted between", value1, value2, "deleted"); addCriterion("case_id in", values, "caseId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) { public Criteria andCaseIdNotIn(List<String> values) {
addCriterion("deleted not between", value1, value2, "deleted"); addCriterion("case_id not in", values, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdBetween(String value1, String value2) {
addCriterion("case_id between", value1, value2, "caseId");
return (Criteria) this;
}
public Criteria andCaseIdNotBetween(String value1, String value2) {
addCriterion("case_id not between", value1, value2, "caseId");
return (Criteria) this; return (Criteria) this;
} }
} }

View File

@ -18,8 +18,9 @@
<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="executor" jdbcType="VARCHAR" property="executor" /> <result column="executor" jdbcType="VARCHAR" property="executor" />
<result column="collection_id" jdbcType="VARCHAR" property="collectionId" />
<result column="deleted" jdbcType="BIT" property="deleted" /> <result column="deleted" jdbcType="BIT" property="deleted" />
<result column="collection_id" jdbcType="VARCHAR" property="collectionId" />
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -82,7 +83,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, task_id, resource_id, resource_name, task_origin, `status`, `result`, resource_pool_id, id, task_id, resource_id, resource_name, task_origin, `status`, `result`, resource_pool_id,
resource_pool_node, resource_type, project_id, organization_id, thread_id, start_time, resource_pool_node, resource_type, project_id, organization_id, thread_id, start_time,
end_time, executor, collection_id, deleted end_time, executor, deleted, collection_id, case_id
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.system.domain.ExecTaskItemExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.system.domain.ExecTaskItemExample" resultMap="BaseResultMap">
select select
@ -120,15 +121,15 @@
`result`, resource_pool_id, resource_pool_node, `result`, resource_pool_id, resource_pool_node,
resource_type, project_id, organization_id, resource_type, project_id, organization_id,
thread_id, start_time, end_time, thread_id, start_time, end_time,
executor, collection_id, deleted executor, deleted, collection_id,
) case_id)
values (#{id,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{resourceName,jdbcType=VARCHAR}, #{taskOrigin,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, #{taskOrigin,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{result,jdbcType=VARCHAR}, #{resourcePoolId,jdbcType=VARCHAR}, #{resourcePoolNode,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{resourcePoolId,jdbcType=VARCHAR}, #{resourcePoolNode,jdbcType=VARCHAR},
#{resourceType,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR}, #{resourceType,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR},
#{threadId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{threadId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
#{executor,jdbcType=VARCHAR}, #{collectionId,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT} #{executor,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{collectionId,jdbcType=VARCHAR},
) #{caseId,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.ExecTaskItem"> <insert id="insertSelective" parameterType="io.metersphere.system.domain.ExecTaskItem">
insert into exec_task_item insert into exec_task_item
@ -181,11 +182,14 @@
<if test="executor != null"> <if test="executor != null">
executor, executor,
</if> </if>
<if test="deleted != null">
deleted,
</if>
<if test="collectionId != null"> <if test="collectionId != null">
collection_id, collection_id,
</if> </if>
<if test="deleted != null"> <if test="caseId != null">
deleted, case_id,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -237,11 +241,14 @@
<if test="executor != null"> <if test="executor != null">
#{executor,jdbcType=VARCHAR}, #{executor,jdbcType=VARCHAR},
</if> </if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
<if test="collectionId != null"> <if test="collectionId != null">
#{collectionId,jdbcType=VARCHAR}, #{collectionId,jdbcType=VARCHAR},
</if> </if>
<if test="deleted != null"> <if test="caseId != null">
#{deleted,jdbcType=BIT}, #{caseId,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
</insert> </insert>
@ -302,11 +309,14 @@
<if test="record.executor != null"> <if test="record.executor != null">
executor = #{record.executor,jdbcType=VARCHAR}, executor = #{record.executor,jdbcType=VARCHAR},
</if> </if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
<if test="record.collectionId != null"> <if test="record.collectionId != null">
collection_id = #{record.collectionId,jdbcType=VARCHAR}, collection_id = #{record.collectionId,jdbcType=VARCHAR},
</if> </if>
<if test="record.deleted != null"> <if test="record.caseId != null">
deleted = #{record.deleted,jdbcType=BIT}, case_id = #{record.caseId,jdbcType=VARCHAR},
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
@ -331,8 +341,9 @@
start_time = #{record.startTime,jdbcType=BIGINT}, start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT}, end_time = #{record.endTime,jdbcType=BIGINT},
executor = #{record.executor,jdbcType=VARCHAR}, executor = #{record.executor,jdbcType=VARCHAR},
deleted = #{record.deleted,jdbcType=BIT},
collection_id = #{record.collectionId,jdbcType=VARCHAR}, collection_id = #{record.collectionId,jdbcType=VARCHAR},
deleted = #{record.deleted,jdbcType=BIT} case_id = #{record.caseId,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -385,11 +396,14 @@
<if test="executor != null"> <if test="executor != null">
executor = #{executor,jdbcType=VARCHAR}, executor = #{executor,jdbcType=VARCHAR},
</if> </if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
<if test="collectionId != null"> <if test="collectionId != null">
collection_id = #{collectionId,jdbcType=VARCHAR}, collection_id = #{collectionId,jdbcType=VARCHAR},
</if> </if>
<if test="deleted != null"> <if test="caseId != null">
deleted = #{deleted,jdbcType=BIT}, case_id = #{caseId,jdbcType=VARCHAR},
</if> </if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
@ -411,15 +425,16 @@
start_time = #{startTime,jdbcType=BIGINT}, start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT}, end_time = #{endTime,jdbcType=BIGINT},
executor = #{executor,jdbcType=VARCHAR}, executor = #{executor,jdbcType=VARCHAR},
deleted = #{deleted,jdbcType=BIT},
collection_id = #{collectionId,jdbcType=VARCHAR}, collection_id = #{collectionId,jdbcType=VARCHAR},
deleted = #{deleted,jdbcType=BIT} case_id = #{caseId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
insert into exec_task_item insert into exec_task_item
(id, task_id, resource_id, resource_name, task_origin, `status`, `result`, resource_pool_id, (id, task_id, resource_id, resource_name, task_origin, `status`, `result`, resource_pool_id,
resource_pool_node, resource_type, project_id, organization_id, thread_id, start_time, resource_pool_node, resource_type, project_id, organization_id, thread_id, start_time,
end_time, executor, collection_id, deleted) end_time, executor, deleted, collection_id, case_id)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.taskId,jdbcType=VARCHAR}, #{item.resourceId,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.taskId,jdbcType=VARCHAR}, #{item.resourceId,jdbcType=VARCHAR},
@ -427,8 +442,8 @@
#{item.result,jdbcType=VARCHAR}, #{item.resourcePoolId,jdbcType=VARCHAR}, #{item.resourcePoolNode,jdbcType=VARCHAR}, #{item.result,jdbcType=VARCHAR}, #{item.resourcePoolId,jdbcType=VARCHAR}, #{item.resourcePoolNode,jdbcType=VARCHAR},
#{item.resourceType,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.organizationId,jdbcType=VARCHAR}, #{item.resourceType,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.organizationId,jdbcType=VARCHAR},
#{item.threadId,jdbcType=VARCHAR}, #{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT}, #{item.threadId,jdbcType=VARCHAR}, #{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT},
#{item.executor,jdbcType=VARCHAR}, #{item.collectionId,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT} #{item.executor,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT}, #{item.collectionId,jdbcType=VARCHAR},
) #{item.caseId,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -489,11 +504,14 @@
<if test="'executor'.toString() == column.value"> <if test="'executor'.toString() == column.value">
#{item.executor,jdbcType=VARCHAR} #{item.executor,jdbcType=VARCHAR}
</if> </if>
<if test="'deleted'.toString() == column.value">
#{item.deleted,jdbcType=BIT}
</if>
<if test="'collection_id'.toString() == column.value"> <if test="'collection_id'.toString() == column.value">
#{item.collectionId,jdbcType=VARCHAR} #{item.collectionId,jdbcType=VARCHAR}
</if> </if>
<if test="'deleted'.toString() == column.value"> <if test="'case_id'.toString() == column.value">
#{item.deleted,jdbcType=BIT} #{item.caseId,jdbcType=VARCHAR}
</if> </if>
</foreach> </foreach>
) )

View File

@ -74,7 +74,8 @@ CREATE INDEX idx_project_id_delete_create_time_create_user
ALTER TABLE exec_task ADD COLUMN deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '删除标识'; ALTER TABLE exec_task ADD COLUMN deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '删除标识';
ALTER TABLE exec_task_item ADD COLUMN deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '删除标识'; ALTER TABLE exec_task_item ADD COLUMN deleted bit(1) NOT NULL DEFAULT b'0' COMMENT '删除标识';
ALTER TABLE exec_task_item ADD COLUMN case_id VARCHAR(50) COMMENT '用例表id';
CREATE INDEX idx_case_id ON exec_task_item(case_id);
-- 任务项添加测试集字段 -- 任务项添加测试集字段
ALTER TABLE exec_task_item ADD collection_id varchar(50) NULL COMMENT '测试集ID'; ALTER TABLE exec_task_item ADD collection_id varchar(50) NULL COMMENT '测试集ID';

View File

@ -77,6 +77,7 @@ public class ApiScenarioScheduleJob extends BaseScheduleJob {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.API_SCENARIO.name()); execTaskItem.setResourceType(ApiExecuteResourceType.API_SCENARIO.name());
execTaskItem.setResourceId(apiScenarioDetail.getId()); execTaskItem.setResourceId(apiScenarioDetail.getId());
execTaskItem.setCaseId(apiScenarioDetail.getId());
execTaskItem.setResourceName(apiScenarioDetail.getName()); execTaskItem.setResourceName(apiScenarioDetail.getName());
baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem); baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem);

View File

@ -139,6 +139,7 @@ public class ApiTestCaseBatchRunService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.API_CASE.name()); execTaskItem.setResourceType(ApiExecuteResourceType.API_CASE.name());
execTaskItem.setResourceId(apiTestCase.getId()); execTaskItem.setResourceId(apiTestCase.getId());
execTaskItem.setCaseId(apiTestCase.getId());
execTaskItem.setResourceName(apiTestCase.getName()); execTaskItem.setResourceName(apiTestCase.getName());
execTaskItems.add(execTaskItem); execTaskItems.add(execTaskItem);
} }

View File

@ -108,6 +108,7 @@ public class ApiTestCaseRunService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.API_CASE.name()); execTaskItem.setResourceType(ApiExecuteResourceType.API_CASE.name());
execTaskItem.setResourceId(apiTestCase.getId()); execTaskItem.setResourceId(apiTestCase.getId());
execTaskItem.setCaseId(apiTestCase.getId());
execTaskItem.setResourceName(apiTestCase.getName()); execTaskItem.setResourceName(apiTestCase.getName());
baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem); baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem);

View File

@ -240,6 +240,7 @@ public class ApiScenarioBatchRunService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.API_SCENARIO.name()); execTaskItem.setResourceType(ApiExecuteResourceType.API_SCENARIO.name());
execTaskItem.setResourceId(apiScenario.getId()); execTaskItem.setResourceId(apiScenario.getId());
execTaskItem.setCaseId(apiScenario.getId());
execTaskItem.setResourceName(apiScenario.getName()); execTaskItem.setResourceName(apiScenario.getName());
execTaskItems.add(execTaskItem); execTaskItems.add(execTaskItem);
} }

View File

@ -201,6 +201,7 @@ public class ApiScenarioRunService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.API_SCENARIO.name()); execTaskItem.setResourceType(ApiExecuteResourceType.API_SCENARIO.name());
execTaskItem.setResourceId(apiScenario.getId()); execTaskItem.setResourceId(apiScenario.getId());
execTaskItem.setCaseId(apiScenario.getId());
execTaskItem.setResourceName(apiScenario.getName()); execTaskItem.setResourceName(apiScenario.getName());
baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem); baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem);

View File

@ -620,6 +620,7 @@ public class BaseTaskHubControllerTests extends BaseTest {
execTaskItem.setId("1111"); execTaskItem.setId("1111");
execTaskItem.setTaskId("1"); execTaskItem.setTaskId("1");
execTaskItem.setResourceId("1"); execTaskItem.setResourceId("1");
execTaskItem.setCaseId("1");
execTaskItem.setStatus("SUCCESS"); execTaskItem.setStatus("SUCCESS");
execTaskItem.setResourcePoolId("1"); execTaskItem.setResourcePoolId("1");
execTaskItem.setResourceType("FUNCTIONAL"); execTaskItem.setResourceType("FUNCTIONAL");

View File

@ -7,4 +7,5 @@ public class TestPlanApiCaseBatchRunDTO {
private String id; private String id;
private String name; private String name;
private String testPlanCollectionId; private String testPlanCollectionId;
private String caseId;
} }

View File

@ -7,4 +7,5 @@ public class TestPlanApiScenarioBatchRunDTO {
private String id; private String id;
private String name; private String name;
private String testPlanCollectionId; private String testPlanCollectionId;
private String caseId;
} }

View File

@ -841,7 +841,7 @@
</select> </select>
<select id="getSelectIdAndCollectionId" resultType="io.metersphere.plan.dto.TestPlanApiCaseBatchRunDTO"> <select id="getSelectIdAndCollectionId" resultType="io.metersphere.plan.dto.TestPlanApiCaseBatchRunDTO">
SELECT t.id as id, t.test_plan_collection_id as test_plan_collection_id, atc.name as name SELECT t.id as id, t.test_plan_collection_id as test_plan_collection_id, atc.name as name, atc.id as caseId
FROM test_plan_api_case t FROM test_plan_api_case t
INNER JOIN api_test_case atc ON t.api_case_id = atc.id INNER JOIN api_test_case atc ON t.api_case_id = atc.id
INNER JOIN api_definition a ON atc.api_definition_id = a.id INNER JOIN api_definition a ON atc.api_definition_id = a.id
@ -893,7 +893,7 @@
AND test_plan.status != 'ARCHIVED' AND test_plan.status != 'ARCHIVED'
</select> </select>
<select id="getBatchRunInfoByIds" resultType="io.metersphere.plan.dto.TestPlanApiCaseBatchRunDTO"> <select id="getBatchRunInfoByIds" resultType="io.metersphere.plan.dto.TestPlanApiCaseBatchRunDTO">
SELECT t.id as id, t.test_plan_collection_id as test_plan_collection_id, atc.name as name SELECT t.id as id, t.test_plan_collection_id as test_plan_collection_id, atc.name as name, atc.id as caseId
FROM test_plan_api_case t FROM test_plan_api_case t
INNER JOIN api_test_case atc ON t.api_case_id = atc.id INNER JOIN api_test_case atc ON t.api_case_id = atc.id
where where

View File

@ -535,7 +535,7 @@
<select id="getSelectIdAndCollectionId" resultType="io.metersphere.plan.dto.TestPlanApiScenarioBatchRunDTO"> <select id="getSelectIdAndCollectionId" resultType="io.metersphere.plan.dto.TestPlanApiScenarioBatchRunDTO">
SELECT SELECT
test_plan_api_scenario.id as id, test_plan_api_scenario.test_plan_collection_id as testPlanCollectionId, test_plan_api_scenario.id as id, test_plan_api_scenario.test_plan_collection_id as testPlanCollectionId,
api_scenario.name as name api_scenario.name as name, api_scenario.id as caseId
FROM FROM
test_plan_api_scenario test_plan_api_scenario
INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id
@ -634,7 +634,7 @@
</select> </select>
<select id="getBatchRunInfoByIds" resultType="io.metersphere.plan.dto.TestPlanApiScenarioBatchRunDTO"> <select id="getBatchRunInfoByIds" resultType="io.metersphere.plan.dto.TestPlanApiScenarioBatchRunDTO">
SELECT tpas.id, tpas.test_plan_collection_id, t.name as name SELECT tpas.id, tpas.test_plan_collection_id, t.name as name, t.id as caseId
FROM test_plan_api_scenario tpas FROM test_plan_api_scenario tpas
INNER JOIN api_scenario t ON tpas.api_scenario_id = t.id INNER JOIN api_scenario t ON tpas.api_scenario_id = t.id
WHERE WHERE

View File

@ -303,6 +303,7 @@ public class TestPlanApiCaseBatchRunService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_CASE.name()); execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_CASE.name());
execTaskItem.setResourceId(apiTestCase.getId()); execTaskItem.setResourceId(apiTestCase.getId());
execTaskItem.setCaseId(apiTestCase.getCaseId());
execTaskItem.setResourceName(apiTestCase.getName()); execTaskItem.setResourceName(apiTestCase.getName());
execTaskItem.setCollectionId(apiTestCase.getTestPlanCollectionId()); execTaskItem.setCollectionId(apiTestCase.getTestPlanCollectionId());
execTaskItems.add(execTaskItem); execTaskItems.add(execTaskItem);

View File

@ -767,7 +767,9 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
ExecTaskItem execTaskItem = apiCommonService.newExecTaskItem(execTask.getId(), project.getId(), userId); ExecTaskItem execTaskItem = apiCommonService.newExecTaskItem(execTask.getId(), project.getId(), userId);
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_CASE.name()); execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_CASE.name());
execTaskItem.setResourceId(apiTestCase.getId()); execTaskItem.setResourceId(testPlanApiCase.getId());
execTaskItem.setCaseId(apiTestCase.getId());
execTaskItem.setTaskOrigin(testPlanApiCase.getTestPlanId());
execTaskItem.setResourceName(apiTestCase.getName()); execTaskItem.setResourceName(apiTestCase.getName());
baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem); baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem);

View File

@ -281,6 +281,7 @@ public class TestPlanApiScenarioBatchRunService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_SCENARIO.name()); execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_SCENARIO.name());
execTaskItem.setResourceId(testPlanApiScenario.getId()); execTaskItem.setResourceId(testPlanApiScenario.getId());
execTaskItem.setCaseId(testPlanApiScenario.getCaseId());
execTaskItem.setResourceName(testPlanApiScenario.getName()); execTaskItem.setResourceName(testPlanApiScenario.getName());
execTaskItem.setCollectionId(testPlanApiScenario.getTestPlanCollectionId()); execTaskItem.setCollectionId(testPlanApiScenario.getTestPlanCollectionId());
execTaskItems.add(execTaskItem); execTaskItems.add(execTaskItem);

View File

@ -350,6 +350,8 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_SCENARIO.name()); execTaskItem.setResourceType(ApiExecuteResourceType.TEST_PLAN_API_SCENARIO.name());
execTaskItem.setResourceId(testPlanApiScenario.getId()); execTaskItem.setResourceId(testPlanApiScenario.getId());
execTaskItem.setCaseId(testPlanApiScenario.getApiScenarioId());
execTaskItem.setTaskOrigin(testPlanApiScenario.getTestPlanId());
execTaskItem.setResourceName(apiScenario.getName()); execTaskItem.setResourceName(apiScenario.getName());
baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem); baseTaskHubService.insertExecTaskAndDetail(execTask, execTaskItem);

View File

@ -660,6 +660,7 @@ public class TestPlanReportService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.PLAN_RUN_API_CASE.name()); execTaskItem.setResourceType(ApiExecuteResourceType.PLAN_RUN_API_CASE.name());
execTaskItem.setResourceId(apiTestCase.getId()); execTaskItem.setResourceId(apiTestCase.getId());
execTaskItem.setCaseId(apiTestCase.getApiCaseId());
execTaskItem.setResourceName(apiTestCase.getApiCaseName()); execTaskItem.setResourceName(apiTestCase.getApiCaseName());
execTaskItem.setTaskOrigin(testPlanId); execTaskItem.setTaskOrigin(testPlanId);
execTaskItem.setCollectionId(apiTestCase.getTestPlanCollectionId()); execTaskItem.setCollectionId(apiTestCase.getTestPlanCollectionId());
@ -675,6 +676,7 @@ public class TestPlanReportService {
execTaskItem.setOrganizationId(project.getOrganizationId()); execTaskItem.setOrganizationId(project.getOrganizationId());
execTaskItem.setResourceType(ApiExecuteResourceType.PLAN_RUN_API_SCENARIO.name()); execTaskItem.setResourceType(ApiExecuteResourceType.PLAN_RUN_API_SCENARIO.name());
execTaskItem.setResourceId(testPlanReportApiScenario.getId()); execTaskItem.setResourceId(testPlanReportApiScenario.getId());
execTaskItem.setCaseId(testPlanReportApiScenario.getApiScenarioId());
execTaskItem.setResourceName(testPlanReportApiScenario.getApiScenarioName()); execTaskItem.setResourceName(testPlanReportApiScenario.getApiScenarioName());
execTaskItem.setCollectionId(testPlanReportApiScenario.getTestPlanCollectionId()); execTaskItem.setCollectionId(testPlanReportApiScenario.getTestPlanCollectionId());
execTaskItem.setTaskOrigin(testPlanId); execTaskItem.setTaskOrigin(testPlanId);