refactor(任务中心): 改造任务中心与执行历史结合
This commit is contained in:
parent
822bb5b664
commit
e40dba8fbe
|
@ -76,6 +76,10 @@ public class ExecTask implements Serializable {
|
|||
@NotNull(message = "{exec_task.integrated.not_blank}", groups = {Created.class})
|
||||
private Boolean integrated;
|
||||
|
||||
@Schema(description = "删除标识", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "{exec_task.deleted.not_blank}", groups = {Created.class})
|
||||
private Boolean deleted;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum Column {
|
||||
|
@ -94,7 +98,8 @@ public class ExecTask implements Serializable {
|
|||
createUser("create_user", "createUser", "VARCHAR", false),
|
||||
startTime("start_time", "startTime", "BIGINT", false),
|
||||
endTime("end_time", "endTime", "BIGINT", false),
|
||||
integrated("integrated", "integrated", "BIT", false);
|
||||
integrated("integrated", "integrated", "BIT", false),
|
||||
deleted("deleted", "deleted", "BIT", false);
|
||||
|
||||
private static final String BEGINNING_DELIMITER = "`";
|
||||
|
||||
|
|
|
@ -574,76 +574,6 @@ public class ExecTaskExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNull() {
|
||||
addCriterion("resource_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNotNull() {
|
||||
addCriterion("resource_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdEqualTo(String value) {
|
||||
addCriterion("resource_id =", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotEqualTo(String value) {
|
||||
addCriterion("resource_id <>", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThan(String value) {
|
||||
addCriterion("resource_id >", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id >=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThan(String value) {
|
||||
addCriterion("resource_id <", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id <=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLike(String value) {
|
||||
addCriterion("resource_id like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotLike(String value) {
|
||||
addCriterion("resource_id not like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIn(List<String> values) {
|
||||
addCriterion("resource_id in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotIn(List<String> values) {
|
||||
addCriterion("resource_id not in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdBetween(String value1, String value2) {
|
||||
addCriterion("resource_id between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_id not between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTriggerModeIsNull() {
|
||||
addCriterion("trigger_mode is null");
|
||||
return (Criteria) this;
|
||||
|
@ -1163,6 +1093,136 @@ public class ExecTaskExample {
|
|||
addCriterion("integrated not between", value1, value2, "integrated");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNull() {
|
||||
addCriterion("resource_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNotNull() {
|
||||
addCriterion("resource_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdEqualTo(String value) {
|
||||
addCriterion("resource_id =", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotEqualTo(String value) {
|
||||
addCriterion("resource_id <>", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThan(String value) {
|
||||
addCriterion("resource_id >", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id >=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThan(String value) {
|
||||
addCriterion("resource_id <", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id <=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLike(String value) {
|
||||
addCriterion("resource_id like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotLike(String value) {
|
||||
addCriterion("resource_id not like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIn(List<String> values) {
|
||||
addCriterion("resource_id in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotIn(List<String> values) {
|
||||
addCriterion("resource_id not in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdBetween(String value1, String value2) {
|
||||
addCriterion("resource_id between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_id not between", value1, value2, "resourceId");
|
||||
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 static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.metersphere.validation.groups.Created;
|
|||
import io.metersphere.validation.groups.Updated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -80,6 +81,10 @@ public class ExecTaskItem implements Serializable {
|
|||
@Size(min = 1, max = 50, message = "{exec_task_item.executor.length_range}", groups = {Created.class, Updated.class})
|
||||
private String executor;
|
||||
|
||||
@Schema(description = "删除标识", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "{exec_task_item.deleted.not_blank}", groups = {Created.class})
|
||||
private Boolean deleted;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public enum Column {
|
||||
|
@ -98,7 +103,8 @@ public class ExecTaskItem implements Serializable {
|
|||
threadId("thread_id", "threadId", "VARCHAR", false),
|
||||
startTime("start_time", "startTime", "BIGINT", false),
|
||||
endTime("end_time", "endTime", "BIGINT", false),
|
||||
executor("executor", "executor", "VARCHAR", false);
|
||||
executor("executor", "executor", "VARCHAR", false),
|
||||
deleted("deleted", "deleted", "BIT", false);
|
||||
|
||||
private static final String BEGINNING_DELIMITER = "`";
|
||||
|
||||
|
|
|
@ -1203,6 +1203,66 @@ public class ExecTaskItemExample {
|
|||
addCriterion("executor not between", value1, value2, "executor");
|
||||
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 static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<result column="start_time" jdbcType="BIGINT" property="startTime" />
|
||||
<result column="end_time" jdbcType="BIGINT" property="endTime" />
|
||||
<result column="executor" jdbcType="VARCHAR" property="executor" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -80,7 +81,7 @@
|
|||
<sql id="Base_Column_List">
|
||||
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,
|
||||
end_time, executor
|
||||
end_time, executor, deleted
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.ExecTaskItemExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -118,13 +119,13 @@
|
|||
`result`, resource_pool_id, resource_pool_node,
|
||||
resource_type, project_id, organization_id,
|
||||
thread_id, start_time, end_time,
|
||||
executor)
|
||||
executor, deleted)
|
||||
values (#{id,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
|
||||
#{resourceName,jdbcType=VARCHAR}, #{taskOrigin,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{result,jdbcType=VARCHAR}, #{resourcePoolId,jdbcType=VARCHAR}, #{resourcePoolNode,jdbcType=VARCHAR},
|
||||
#{resourceType,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR},
|
||||
#{threadId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
|
||||
#{executor,jdbcType=VARCHAR})
|
||||
#{executor,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.ExecTaskItem">
|
||||
insert into exec_task_item
|
||||
|
@ -177,6 +178,9 @@
|
|||
<if test="executor != null">
|
||||
executor,
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -227,6 +231,9 @@
|
|||
<if test="executor != null">
|
||||
#{executor,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
#{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.system.domain.ExecTaskItemExample" resultType="java.lang.Long">
|
||||
|
@ -286,6 +293,9 @@
|
|||
<if test="record.executor != null">
|
||||
executor = #{record.executor,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.deleted != null">
|
||||
deleted = #{record.deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -308,7 +318,8 @@
|
|||
thread_id = #{record.threadId,jdbcType=VARCHAR},
|
||||
start_time = #{record.startTime,jdbcType=BIGINT},
|
||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||
executor = #{record.executor,jdbcType=VARCHAR}
|
||||
executor = #{record.executor,jdbcType=VARCHAR},
|
||||
deleted = #{record.deleted,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -361,6 +372,9 @@
|
|||
<if test="executor != null">
|
||||
executor = #{executor,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -380,14 +394,15 @@
|
|||
thread_id = #{threadId,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=BIGINT},
|
||||
end_time = #{endTime,jdbcType=BIGINT},
|
||||
executor = #{executor,jdbcType=VARCHAR}
|
||||
executor = #{executor,jdbcType=VARCHAR},
|
||||
deleted = #{deleted,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into exec_task_item
|
||||
(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,
|
||||
end_time, executor)
|
||||
end_time, executor, deleted)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.taskId,jdbcType=VARCHAR}, #{item.resourceId,jdbcType=VARCHAR},
|
||||
|
@ -395,7 +410,7 @@
|
|||
#{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.threadId,jdbcType=VARCHAR}, #{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT},
|
||||
#{item.executor,jdbcType=VARCHAR})
|
||||
#{item.executor,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective" parameterType="map">
|
||||
|
@ -456,6 +471,9 @@
|
|||
<if test="'executor'.toString() == column.value">
|
||||
#{item.executor,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'deleted'.toString() == column.value">
|
||||
#{item.deleted,jdbcType=BIT}
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</foreach>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<result column="case_count" jdbcType="BIGINT" property="caseCount" />
|
||||
<result column="result" jdbcType="VARCHAR" property="result" />
|
||||
<result column="task_type" jdbcType="VARCHAR" property="taskType" />
|
||||
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
||||
<result column="trigger_mode" jdbcType="VARCHAR" property="triggerMode" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
|
||||
|
@ -18,6 +17,8 @@
|
|||
<result column="start_time" jdbcType="BIGINT" property="startTime" />
|
||||
<result column="end_time" jdbcType="BIGINT" property="endTime" />
|
||||
<result column="integrated" jdbcType="BIT" property="integrated" />
|
||||
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -78,8 +79,9 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, num, task_name, `status`, case_count, `result`, task_type, resource_id, trigger_mode,
|
||||
project_id, organization_id, create_time, create_user, start_time, end_time, integrated
|
||||
id, num, task_name, `status`, case_count, `result`, task_type, trigger_mode, project_id,
|
||||
organization_id, create_time, create_user, start_time, end_time, integrated, resource_id,
|
||||
deleted
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.system.domain.ExecTaskExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -114,16 +116,16 @@
|
|||
<insert id="insert" parameterType="io.metersphere.system.domain.ExecTask">
|
||||
insert into exec_task (id, num, task_name,
|
||||
`status`, case_count, `result`,
|
||||
task_type, resource_id, trigger_mode,
|
||||
project_id, organization_id, create_time,
|
||||
create_user, start_time, end_time,
|
||||
integrated)
|
||||
task_type, trigger_mode, project_id,
|
||||
organization_id, create_time, create_user,
|
||||
start_time, end_time, integrated,
|
||||
resource_id, deleted)
|
||||
values (#{id,jdbcType=VARCHAR}, #{num,jdbcType=BIGINT}, #{taskName,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{caseCount,jdbcType=BIGINT}, #{result,jdbcType=VARCHAR},
|
||||
#{taskType,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR},
|
||||
#{projectId,jdbcType=VARCHAR}, #{organizationId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{createUser,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
|
||||
#{integrated,jdbcType=BIT})
|
||||
#{taskType,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
|
||||
#{organizationId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
|
||||
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{integrated,jdbcType=BIT},
|
||||
#{resourceId,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.ExecTask">
|
||||
insert into exec_task
|
||||
|
@ -149,9 +151,6 @@
|
|||
<if test="taskType != null">
|
||||
task_type,
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
resource_id,
|
||||
</if>
|
||||
<if test="triggerMode != null">
|
||||
trigger_mode,
|
||||
</if>
|
||||
|
@ -176,6 +175,12 @@
|
|||
<if test="integrated != null">
|
||||
integrated,
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
resource_id,
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -199,9 +204,6 @@
|
|||
<if test="taskType != null">
|
||||
#{taskType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
#{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="triggerMode != null">
|
||||
#{triggerMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -226,6 +228,12 @@
|
|||
<if test="integrated != null">
|
||||
#{integrated,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
#{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
#{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.system.domain.ExecTaskExample" resultType="java.lang.Long">
|
||||
|
@ -258,9 +266,6 @@
|
|||
<if test="record.taskType != null">
|
||||
task_type = #{record.taskType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.resourceId != null">
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.triggerMode != null">
|
||||
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -285,6 +290,12 @@
|
|||
<if test="record.integrated != null">
|
||||
integrated = #{record.integrated,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.resourceId != null">
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.deleted != null">
|
||||
deleted = #{record.deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -299,7 +310,6 @@
|
|||
case_count = #{record.caseCount,jdbcType=BIGINT},
|
||||
`result` = #{record.result,jdbcType=VARCHAR},
|
||||
task_type = #{record.taskType,jdbcType=VARCHAR},
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
organization_id = #{record.organizationId,jdbcType=VARCHAR},
|
||||
|
@ -307,7 +317,9 @@
|
|||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
start_time = #{record.startTime,jdbcType=BIGINT},
|
||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||
integrated = #{record.integrated,jdbcType=BIT}
|
||||
integrated = #{record.integrated,jdbcType=BIT},
|
||||
resource_id = #{record.resourceId,jdbcType=VARCHAR},
|
||||
deleted = #{record.deleted,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -333,9 +345,6 @@
|
|||
<if test="taskType != null">
|
||||
task_type = #{taskType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="triggerMode != null">
|
||||
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -360,6 +369,12 @@
|
|||
<if test="integrated != null">
|
||||
integrated = #{integrated,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="resourceId != null">
|
||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -371,7 +386,6 @@
|
|||
case_count = #{caseCount,jdbcType=BIGINT},
|
||||
`result` = #{result,jdbcType=VARCHAR},
|
||||
task_type = #{taskType,jdbcType=VARCHAR},
|
||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
organization_id = #{organizationId,jdbcType=VARCHAR},
|
||||
|
@ -379,22 +393,24 @@
|
|||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=BIGINT},
|
||||
end_time = #{endTime,jdbcType=BIGINT},
|
||||
integrated = #{integrated,jdbcType=BIT}
|
||||
integrated = #{integrated,jdbcType=BIT},
|
||||
resource_id = #{resourceId,jdbcType=VARCHAR},
|
||||
deleted = #{deleted,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
insert into exec_task
|
||||
(id, num, task_name, `status`, case_count, `result`, task_type, resource_id, trigger_mode,
|
||||
project_id, organization_id, create_time, create_user, start_time, end_time, integrated
|
||||
)
|
||||
(id, num, task_name, `status`, case_count, `result`, task_type, trigger_mode, project_id,
|
||||
organization_id, create_time, create_user, start_time, end_time, integrated, resource_id,
|
||||
deleted)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id,jdbcType=VARCHAR}, #{item.num,jdbcType=BIGINT}, #{item.taskName,jdbcType=VARCHAR},
|
||||
#{item.status,jdbcType=VARCHAR}, #{item.caseCount,jdbcType=BIGINT}, #{item.result,jdbcType=VARCHAR},
|
||||
#{item.taskType,jdbcType=VARCHAR}, #{item.resourceId,jdbcType=VARCHAR}, #{item.triggerMode,jdbcType=VARCHAR},
|
||||
#{item.projectId,jdbcType=VARCHAR}, #{item.organizationId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
|
||||
#{item.createUser,jdbcType=VARCHAR}, #{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT},
|
||||
#{item.integrated,jdbcType=BIT})
|
||||
#{item.taskType,jdbcType=VARCHAR}, #{item.triggerMode,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR},
|
||||
#{item.organizationId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
|
||||
#{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT}, #{item.integrated,jdbcType=BIT},
|
||||
#{item.resourceId,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective" parameterType="map">
|
||||
|
@ -428,9 +444,6 @@
|
|||
<if test="'task_type'.toString() == column.value">
|
||||
#{item.taskType,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'resource_id'.toString() == column.value">
|
||||
#{item.resourceId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'trigger_mode'.toString() == column.value">
|
||||
#{item.triggerMode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
@ -455,6 +468,12 @@
|
|||
<if test="'integrated'.toString() == column.value">
|
||||
#{item.integrated,jdbcType=BIT}
|
||||
</if>
|
||||
<if test="'resource_id'.toString() == column.value">
|
||||
#{item.resourceId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="'deleted'.toString() == column.value">
|
||||
#{item.deleted,jdbcType=BIT}
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</foreach>
|
||||
|
|
|
@ -72,5 +72,8 @@ CREATE INDEX idx_project_id_delete_create_time
|
|||
CREATE INDEX idx_project_id_delete_create_time_create_user
|
||||
ON bug (project_id, deleted, create_time, create_user);
|
||||
|
||||
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 '删除标识';
|
||||
|
||||
-- set innodb lock wait timeout to default
|
||||
SET SESSION innodb_lock_wait_timeout = DEFAULT;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package io.metersphere.api.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtApiReportRelateTaskMapper {
|
||||
|
||||
List<String> selectDeleteTaskOrItem(@Param("ids") List<String> ids);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.api.mapper.ExtApiReportRelateTaskMapper">
|
||||
|
||||
<select id="selectDeleteTaskOrItem" resultType="java.lang.String">
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
exec_task
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND deleted = TRUE UNION
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
exec_task_item
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND deleted = TRUE
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -6,9 +6,11 @@ import io.metersphere.sdk.constants.ProjectApplicationType;
|
|||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.system.service.BaseCleanUpReport;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -42,6 +44,8 @@ public class CleanupApiReportServiceImpl implements BaseCleanUpReport {
|
|||
private ApiScenarioReportDetailBlobMapper apiScenarioReportDetailBlobMapper;
|
||||
@Resource
|
||||
private ApiReportRelateTaskMapper apiReportRelateTaskMapper;
|
||||
@Resource
|
||||
private ExtApiReportRelateTaskMapper extApiReportRelateTaskMapper;
|
||||
|
||||
@Override
|
||||
public void cleanReport(Map<String, String> map, String projectId) {
|
||||
|
@ -80,6 +84,7 @@ public class CleanupApiReportServiceImpl implements BaseCleanUpReport {
|
|||
|
||||
/**
|
||||
* 获取任务报告ID
|
||||
*
|
||||
* @param reportIds 报告ID集合
|
||||
* @return 任务报告ID集合
|
||||
*/
|
||||
|
@ -87,6 +92,12 @@ public class CleanupApiReportServiceImpl implements BaseCleanUpReport {
|
|||
ApiReportRelateTaskExample example = new ApiReportRelateTaskExample();
|
||||
example.createCriteria().andReportIdIn(reportIds);
|
||||
List<ApiReportRelateTask> relateTasks = apiReportRelateTaskMapper.selectByExample(example);
|
||||
List<String> ids = relateTasks.stream().map(ApiReportRelateTask::getTaskResourceId).toList();
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> deletedIds = extApiReportRelateTaskMapper.selectDeleteTaskOrItem(ids);
|
||||
relateTasks.removeIf(relateTask -> deletedIds.contains(relateTask.getTaskResourceId()));
|
||||
return relateTasks.stream().map(ApiReportRelateTask::getReportId).toList();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import io.metersphere.api.domain.ApiReportRelateTaskExample;
|
||||
import io.metersphere.api.mapper.ApiReportRelateTaskMapper;
|
||||
import io.metersphere.sdk.constants.ProjectApplicationType;
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.sdk.util.SubListUtils;
|
||||
import io.metersphere.system.domain.ExecTask;
|
||||
import io.metersphere.system.domain.ExecTaskExample;
|
||||
import io.metersphere.system.domain.ExecTaskItem;
|
||||
import io.metersphere.system.domain.ExecTaskItemExample;
|
||||
import io.metersphere.system.mapper.ExecTaskItemMapper;
|
||||
import io.metersphere.system.mapper.ExecTaskMapper;
|
||||
import io.metersphere.system.mapper.ExtExecTaskItemMapper;
|
||||
import io.metersphere.system.mapper.ExtExecTaskMapper;
|
||||
import io.metersphere.system.service.BaseCleanUpReport;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -26,31 +28,37 @@ import static io.metersphere.sdk.util.ShareUtil.getCleanDate;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CleanupTaskResultServiceImpl implements BaseCleanUpReport {
|
||||
|
||||
@Resource
|
||||
private ExtExecTaskMapper extExecTaskMapper;
|
||||
@Resource
|
||||
private ExtExecTaskItemMapper extExecTaskItemMapper;
|
||||
@Resource
|
||||
private ApiReportRelateTaskMapper apiReportRelateTaskMapper;
|
||||
@Resource
|
||||
private ExtExecTaskMapper extExecTaskMapper;
|
||||
@Resource
|
||||
private ExtExecTaskItemMapper extExecTaskItemMapper;
|
||||
@Resource
|
||||
private ExecTaskMapper execTaskMapper;
|
||||
@Resource
|
||||
private ExecTaskItemMapper execTaskItemMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void cleanReport(Map<String, String> map, String projectId) {
|
||||
LogUtils.info("清理当前项目[" + projectId + "]任务中心执行结果");
|
||||
String expr = map.get(ProjectApplicationType.TASK.TASK_CLEAN_REPORT.name());
|
||||
long timeMills = getCleanDate(expr);
|
||||
List<String> cleanTaskIds = extExecTaskMapper.getTaskIdsByTime(timeMills, projectId);
|
||||
List<String> cleanTaskItemIds = extExecTaskItemMapper.getTaskItemIdsByTime(timeMills, projectId);
|
||||
List<String> cleanIds = ListUtils.union(cleanTaskIds, cleanTaskItemIds);
|
||||
LogUtils.info("清理当前项目[" + projectId + "]任务中心执行结果, 共[" + cleanIds.size() + "]条");
|
||||
if (CollectionUtils.isNotEmpty(cleanIds)) {
|
||||
// 清理任务-报告关系表
|
||||
SubListUtils.dealForSubList(cleanIds, 100, ids -> {
|
||||
ApiReportRelateTaskExample example = new ApiReportRelateTaskExample();
|
||||
example.createCriteria().andTaskResourceIdIn(cleanIds);
|
||||
apiReportRelateTaskMapper.deleteByExample(example);
|
||||
});
|
||||
}
|
||||
LogUtils.info("清理当前项目[" + projectId + "]任务中心执行结果结束!");
|
||||
}
|
||||
@Override
|
||||
public void cleanReport(Map<String, String> map, String projectId) {
|
||||
LogUtils.info("清理当前项目[" + projectId + "]任务中心执行结果");
|
||||
String expr = map.get(ProjectApplicationType.TASK.TASK_CLEAN_REPORT.name());
|
||||
long timeMills = getCleanDate(expr);
|
||||
List<String> cleanTaskIds = extExecTaskMapper.getTaskIdsByTime(timeMills, projectId);
|
||||
List<String> cleanTaskItemIds = extExecTaskItemMapper.getTaskItemIdsByTime(timeMills, projectId);
|
||||
if (CollectionUtils.isNotEmpty(cleanTaskIds)) {
|
||||
ExecTaskExample example = new ExecTaskExample();
|
||||
example.createCriteria().andIdIn(cleanTaskIds);
|
||||
ExecTask execTask = new ExecTask();
|
||||
execTask.setDeleted(true);
|
||||
execTaskMapper.updateByExampleSelective(execTask, example);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(cleanTaskItemIds)) {
|
||||
ExecTaskItemExample example = new ExecTaskItemExample();
|
||||
example.createCriteria().andIdIn(cleanTaskItemIds);
|
||||
ExecTaskItem execTaskItem = new ExecTaskItem();
|
||||
execTaskItem.setDeleted(true);
|
||||
execTaskItemMapper.updateByExampleSelective(execTaskItem, example);
|
||||
}
|
||||
LogUtils.info("清理当前项目[" + projectId + "]任务中心执行结果结束!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class CleanupTaskResultTests {
|
|||
task.setResult("PENDING");
|
||||
task.setCreateUser("admin");
|
||||
task.setCreateTime(System.currentTimeMillis());
|
||||
execTaskMapper.insert(task);
|
||||
execTaskMapper.insertSelective(task);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</select>
|
||||
|
||||
<select id="getTaskItemIdsByTime" resultType="java.lang.String">
|
||||
select id from exec_task_item where project_id = #{projectId} and start_time <= #{timeMills}
|
||||
select id from exec_task_item where project_id = #{projectId} and start_time <= #{timeMills} and deleted = false
|
||||
</select>
|
||||
|
||||
<select id="selectExecInfoByTaskIdAndResourceIds" resultType="io.metersphere.system.domain.ExecTaskItem">
|
||||
|
@ -54,6 +54,7 @@
|
|||
|
||||
<sql id="queryWhereCondition">
|
||||
<where>
|
||||
exec_task_item.deleted = false
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and exec_task_item.organization_id = #{orgId}
|
||||
</if>
|
||||
|
@ -161,8 +162,9 @@
|
|||
resource_pool_id
|
||||
FROM
|
||||
exec_task_item
|
||||
WHERE deleted = false
|
||||
<if test="taskIds != null and taskIds.size() > 0">
|
||||
WHERE task_id IN
|
||||
and task_id IN
|
||||
<foreach collection="taskIds" item="taskId" open="(" separator="," close=")">
|
||||
#{taskId}
|
||||
</foreach>
|
||||
|
@ -185,6 +187,7 @@
|
|||
and organization_id = #{organizationId}
|
||||
</if>
|
||||
and `status` = 'RUNNING'
|
||||
and deleted = false
|
||||
</update>
|
||||
|
||||
<select id="hasErrorItem" resultType="java.lang.Boolean">
|
||||
|
@ -213,7 +216,9 @@
|
|||
UPDATE exec_task_item
|
||||
SET `status` = #{status},
|
||||
executor = #{userId}
|
||||
WHERE id in
|
||||
WHERE
|
||||
deleted = false
|
||||
and id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
@ -234,8 +239,9 @@
|
|||
resource_pool_id
|
||||
FROM
|
||||
exec_task_item
|
||||
where deleted = false
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
WHERE id IN
|
||||
and id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
@ -248,6 +254,7 @@
|
|||
inner join exec_task on exec_task_item.task_id = exec_task.id
|
||||
<where>
|
||||
exec_task_item.status = 'RUNNING'
|
||||
and exec_task_item.deleted = false
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and exec_task_item.project_id = #{projectId}
|
||||
</if>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
SELECT *
|
||||
FROM exec_task
|
||||
<where>
|
||||
exec_task.deleted = false
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
and (
|
||||
exec_task.num like concat('%', #{request.keyword},'%')
|
||||
|
@ -27,9 +28,9 @@
|
|||
</sql>
|
||||
|
||||
|
||||
<delete id="deleteTaskByIds">
|
||||
DELETE
|
||||
FROM exec_task
|
||||
<update id="deleteTaskByIds">
|
||||
UPDATE exec_task
|
||||
SET deleted = true
|
||||
WHERE id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
|
@ -40,12 +41,13 @@
|
|||
<if test="orgId != null and orgId != ''">
|
||||
and organization_id = #{orgId}
|
||||
</if>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getIds" resultType="java.lang.String">
|
||||
select id from exec_task
|
||||
<where>
|
||||
deleted = false
|
||||
<if test="flag">
|
||||
and status = 'RUNNING'
|
||||
</if>
|
||||
|
@ -125,10 +127,11 @@
|
|||
and organization_id = #{organizationId}
|
||||
</if>
|
||||
and `status` = 'RUNNING'
|
||||
and deleted = false
|
||||
</update>
|
||||
|
||||
<select id="getTaskIdsByTime" resultType="java.lang.String">
|
||||
select id from exec_task where project_id = #{projectId} and start_time <= #{timeMills}
|
||||
select id from exec_task where project_id = #{projectId} and start_time <= #{timeMills} and deleted = false
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ import io.metersphere.engine.EngineFactory;
|
|||
import io.metersphere.engine.MsHttpClient;
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.project.domain.ProjectExample;
|
||||
import io.metersphere.project.domain.ProjectTestResourcePool;
|
||||
import io.metersphere.project.domain.ProjectTestResourcePoolExample;
|
||||
import io.metersphere.project.mapper.ProjectMapper;
|
||||
import io.metersphere.project.mapper.ProjectTestResourcePoolMapper;
|
||||
import io.metersphere.sdk.constants.*;
|
||||
|
@ -52,17 +50,17 @@ import org.apache.ibatis.session.ExecutorType;
|
|||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionUtils;
|
||||
import org.quartz.CronExpression;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -620,20 +618,12 @@ public class BaseTaskHubService {
|
|||
//2.删除任务明细
|
||||
ExecTaskItemExample itemExample = new ExecTaskItemExample();
|
||||
itemExample.createCriteria().andTaskIdEqualTo(id);
|
||||
execTaskItemMapper.deleteByExample(itemExample);
|
||||
//3.删除任务与报告关联关系
|
||||
deleteReportRelateTask(List.of(id));
|
||||
ExecTaskItem taskItem = new ExecTaskItem();
|
||||
taskItem.setDeleted(true);
|
||||
execTaskItemMapper.updateByExampleSelective(taskItem, itemExample);
|
||||
handleStopTaskAsync(List.of(id));
|
||||
}
|
||||
|
||||
private void deleteReportRelateTask(List<String> ids) {
|
||||
List<String> itemIds = extExecTaskItemMapper.getItemIdByTaskIds(ids);
|
||||
itemIds.addAll(ids);
|
||||
ApiReportRelateTaskExample reportExample = new ApiReportRelateTaskExample();
|
||||
reportExample.createCriteria().andTaskResourceIdIn(itemIds);
|
||||
apiReportRelateTaskMapper.deleteByExample(reportExample);
|
||||
}
|
||||
|
||||
public void batchStopTask(List<String> ids, String userId, String orgId, String projectId) {
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
//1.更新任务状态
|
||||
|
@ -664,9 +654,9 @@ public class BaseTaskHubService {
|
|||
//2.删除任务明细
|
||||
ExecTaskItemExample itemExample = new ExecTaskItemExample();
|
||||
itemExample.createCriteria().andTaskIdIn(ids);
|
||||
execTaskItemMapper.deleteByExample(itemExample);
|
||||
//3.删除任务与报告关联关系
|
||||
deleteReportRelateTask(ids);
|
||||
ExecTaskItem taskItem = new ExecTaskItem();
|
||||
taskItem.setDeleted(true);
|
||||
execTaskItemMapper.updateByExampleSelective(taskItem, itemExample);
|
||||
handleStopTaskAsync(ids);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue