refactor: 优化接口场景查询
This commit is contained in:
parent
195f4dd9a5
commit
08aa84571a
|
@ -253,6 +253,7 @@ public class ApiAutomationService {
|
|||
scenario.setUseUrl(JSONArray.toJSONString(useUrl));
|
||||
scenario.setOrder(ServiceUtils.getNextOrder(scenario.getProjectId(), extApiScenarioMapper::getLastOrder));
|
||||
scenario.setRefId(request.getId());
|
||||
scenario.setLatest(true);
|
||||
//检查场景的请求步骤。如果含有ESB请求步骤的话,要做参数计算处理。
|
||||
esbApiParamService.checkScenarioRequests(request);
|
||||
|
||||
|
@ -383,9 +384,15 @@ public class ApiAutomationService {
|
|||
if (relationshipEdgeService != null) {
|
||||
relationshipEdgeService.initRelationshipEdge(beforeScenario, scenario);
|
||||
}
|
||||
checkAndSetLatestVersion(beforeScenario.getRefId());
|
||||
return scenario;
|
||||
}
|
||||
|
||||
private void checkAndSetLatestVersion(String refId) {
|
||||
extApiScenarioMapper.clearLatestVersion(refId);
|
||||
extApiScenarioMapper.addLatestVersion(refId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时如果有删除自定义请求,则删除对应body文件
|
||||
*
|
||||
|
@ -2096,6 +2103,7 @@ public class ApiAutomationService {
|
|||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
|
||||
apiScenarioMapper.deleteByExample(example);
|
||||
checkAndSetLatestVersion(refId);
|
||||
}
|
||||
|
||||
public List<String> getProjects(RunScenarioRequest request) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ApiScenario implements Serializable {
|
||||
private String id;
|
||||
|
@ -27,6 +28,8 @@ public class ApiScenario implements Serializable {
|
|||
|
||||
private Integer stepTotal;
|
||||
|
||||
private String followPeople;
|
||||
|
||||
private String schedule;
|
||||
|
||||
private Long createTime;
|
||||
|
@ -65,5 +68,7 @@ public class ApiScenario implements Serializable {
|
|||
|
||||
private String refId;
|
||||
|
||||
private Boolean latest;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -864,6 +864,76 @@ public class ApiScenarioExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNull() {
|
||||
addCriterion("follow_people is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNotNull() {
|
||||
addCriterion("follow_people is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleEqualTo(String value) {
|
||||
addCriterion("follow_people =", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotEqualTo(String value) {
|
||||
addCriterion("follow_people <>", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThan(String value) {
|
||||
addCriterion("follow_people >", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people >=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThan(String value) {
|
||||
addCriterion("follow_people <", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people <=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLike(String value) {
|
||||
addCriterion("follow_people like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotLike(String value) {
|
||||
addCriterion("follow_people not like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIn(List<String> values) {
|
||||
addCriterion("follow_people in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotIn(List<String> values) {
|
||||
addCriterion("follow_people not in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleBetween(String value1, String value2) {
|
||||
addCriterion("follow_people between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotBetween(String value1, String value2) {
|
||||
addCriterion("follow_people not between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScheduleIsNull() {
|
||||
addCriterion("schedule is null");
|
||||
return (Criteria) this;
|
||||
|
@ -2123,6 +2193,66 @@ public class ApiScenarioExample {
|
|||
addCriterion("ref_id not between", value1, value2, "refId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestIsNull() {
|
||||
addCriterion("latest is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestIsNotNull() {
|
||||
addCriterion("latest is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestEqualTo(Boolean value) {
|
||||
addCriterion("latest =", value, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestNotEqualTo(Boolean value) {
|
||||
addCriterion("latest <>", value, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestGreaterThan(Boolean value) {
|
||||
addCriterion("latest >", value, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("latest >=", value, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestLessThan(Boolean value) {
|
||||
addCriterion("latest <", value, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("latest <=", value, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestIn(List<Boolean> values) {
|
||||
addCriterion("latest in", values, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestNotIn(List<Boolean> values) {
|
||||
addCriterion("latest not in", values, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("latest between", value1, value2, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLatestNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("latest not between", value1, value2, "latest");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="principal" jdbcType="VARCHAR" property="principal" />
|
||||
<result column="step_total" jdbcType="INTEGER" property="stepTotal" />
|
||||
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
||||
<result column="schedule" jdbcType="VARCHAR" property="schedule" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
|
@ -32,6 +33,7 @@
|
|||
<result column="environment_group_id" jdbcType="VARCHAR" property="environmentGroupId" />
|
||||
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
|
||||
<result column="ref_id" jdbcType="VARCHAR" property="refId" />
|
||||
<result column="latest" jdbcType="BIT" property="latest" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
<result column="scenario_definition" jdbcType="LONGVARCHAR" property="scenarioDefinition" />
|
||||
|
@ -99,9 +101,10 @@
|
|||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, tags, user_id, api_scenario_module_id, module_path, `name`, `level`,
|
||||
`status`, principal, step_total, schedule, create_time, update_time, pass_rate, last_result,
|
||||
report_id, num, original_state, custom_num, create_user, version, delete_time, delete_user_id,
|
||||
execute_times, `order`, environment_type, environment_group_id, version_id, ref_id
|
||||
`status`, principal, step_total, follow_people, schedule, create_time, update_time,
|
||||
pass_rate, last_result, report_id, num, original_state, custom_num, create_user,
|
||||
version, delete_time, delete_user_id, execute_times, `order`, environment_type, environment_group_id,
|
||||
version_id, ref_id, latest
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
scenario_definition, description, use_url, environment_json
|
||||
|
@ -155,30 +158,32 @@
|
|||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
insert into api_scenario (id, project_id, tags,
|
||||
INSERT INTO api_scenario (id, project_id, tags,
|
||||
user_id, api_scenario_module_id, module_path,
|
||||
`name`, `level`, `status`,
|
||||
principal, step_total, schedule,
|
||||
create_time, update_time, pass_rate,
|
||||
last_result, report_id, num,
|
||||
original_state, custom_num, create_user,
|
||||
version, delete_time, delete_user_id,
|
||||
execute_times, `order`, environment_type,
|
||||
environment_group_id, version_id, ref_id,
|
||||
scenario_definition, description,
|
||||
use_url, environment_json)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
|
||||
principal, step_total, follow_people,
|
||||
schedule, create_time, update_time,
|
||||
pass_rate, last_result, report_id,
|
||||
num, original_state, custom_num,
|
||||
create_user, version, delete_time,
|
||||
delete_user_id, execute_times, `order`,
|
||||
environment_type, environment_group_id, version_id,
|
||||
ref_id, latest, scenario_definition,
|
||||
description, use_url, environment_json
|
||||
)
|
||||
VALUES (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{schedule,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{passRate,jdbcType=VARCHAR},
|
||||
#{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER},
|
||||
#{originalState,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
|
||||
#{version,jdbcType=INTEGER}, #{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR},
|
||||
#{executeTimes,jdbcType=INTEGER}, #{order,jdbcType=BIGINT}, #{environmentType,jdbcType=VARCHAR},
|
||||
#{environmentGroupId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
|
||||
#{scenarioDefinition,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
||||
#{useUrl,jdbcType=LONGVARCHAR}, #{environmentJson,jdbcType=LONGVARCHAR})
|
||||
#{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR},
|
||||
#{schedule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||
#{num,jdbcType=INTEGER}, #{originalState,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR},
|
||||
#{createUser,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{deleteTime,jdbcType=BIGINT},
|
||||
#{deleteUserId,jdbcType=VARCHAR}, #{executeTimes,jdbcType=INTEGER}, #{order,jdbcType=BIGINT},
|
||||
#{environmentType,jdbcType=VARCHAR}, #{environmentGroupId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR},
|
||||
#{refId,jdbcType=VARCHAR}, #{latest,jdbcType=BIT}, #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
#{description,jdbcType=LONGVARCHAR}, #{useUrl,jdbcType=LONGVARCHAR}, #{environmentJson,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
insert into api_scenario
|
||||
|
@ -216,6 +221,9 @@
|
|||
<if test="stepTotal != null">
|
||||
step_total,
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people,
|
||||
</if>
|
||||
<if test="schedule != null">
|
||||
schedule,
|
||||
</if>
|
||||
|
@ -273,6 +281,9 @@
|
|||
<if test="refId != null">
|
||||
ref_id,
|
||||
</if>
|
||||
<if test="latest != null">
|
||||
latest,
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
scenario_definition,
|
||||
</if>
|
||||
|
@ -320,6 +331,9 @@
|
|||
<if test="stepTotal != null">
|
||||
#{stepTotal,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
#{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="schedule != null">
|
||||
#{schedule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -377,6 +391,9 @@
|
|||
<if test="refId != null">
|
||||
#{refId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="latest != null">
|
||||
#{latest,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
#{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -433,6 +450,9 @@
|
|||
<if test="record.stepTotal != null">
|
||||
step_total = #{record.stepTotal,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.followPeople != null">
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.schedule != null">
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -490,6 +510,9 @@
|
|||
<if test="record.refId != null">
|
||||
ref_id = #{record.refId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.latest != null">
|
||||
latest = #{record.latest,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.scenarioDefinition != null">
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -520,6 +543,7 @@
|
|||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
principal = #{record.principal,jdbcType=VARCHAR},
|
||||
step_total = #{record.stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
|
@ -539,6 +563,7 @@
|
|||
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
|
||||
version_id = #{record.versionId,jdbcType=VARCHAR},
|
||||
ref_id = #{record.refId,jdbcType=VARCHAR},
|
||||
latest = #{record.latest,jdbcType=BIT},
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
use_url = #{record.useUrl,jdbcType=LONGVARCHAR},
|
||||
|
@ -560,6 +585,7 @@
|
|||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
principal = #{record.principal,jdbcType=VARCHAR},
|
||||
step_total = #{record.stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
|
@ -578,7 +604,8 @@
|
|||
environment_type = #{record.environmentType,jdbcType=VARCHAR},
|
||||
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
|
||||
version_id = #{record.versionId,jdbcType=VARCHAR},
|
||||
ref_id = #{record.refId,jdbcType=VARCHAR}
|
||||
ref_id = #{record.refId,jdbcType=VARCHAR},
|
||||
latest = #{record.latest,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -616,6 +643,9 @@
|
|||
<if test="stepTotal != null">
|
||||
step_total = #{stepTotal,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="schedule != null">
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -673,6 +703,9 @@
|
|||
<if test="refId != null">
|
||||
ref_id = #{refId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="latest != null">
|
||||
latest = #{latest,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -700,6 +733,7 @@
|
|||
`status` = #{status,jdbcType=VARCHAR},
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
step_total = #{stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
|
@ -719,6 +753,7 @@
|
|||
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
|
||||
version_id = #{versionId,jdbcType=VARCHAR},
|
||||
ref_id = #{refId,jdbcType=VARCHAR},
|
||||
latest = #{latest,jdbcType=BIT},
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
use_url = #{useUrl,jdbcType=LONGVARCHAR},
|
||||
|
@ -737,6 +772,7 @@
|
|||
`status` = #{status,jdbcType=VARCHAR},
|
||||
principal = #{principal,jdbcType=VARCHAR},
|
||||
step_total = #{stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
|
@ -755,7 +791,8 @@
|
|||
environment_type = #{environmentType,jdbcType=VARCHAR},
|
||||
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
|
||||
version_id = #{versionId,jdbcType=VARCHAR},
|
||||
ref_id = #{refId,jdbcType=VARCHAR}
|
||||
ref_id = #{refId,jdbcType=VARCHAR},
|
||||
latest = #{latest,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -88,4 +88,8 @@ public interface ExtApiScenarioMapper {
|
|||
void setScenarioEnvGroupIdNull(@Param("environmentGroupId") String environmentGroupId);
|
||||
|
||||
ApiScenarioDTO selectById(@Param("id") String id);
|
||||
|
||||
void clearLatestVersion(String refId);
|
||||
|
||||
void addLatestVersion(String refId);
|
||||
}
|
||||
|
|
|
@ -656,4 +656,43 @@
|
|||
AND ${versionTable}.latest = 1
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<update id="clearLatestVersion">
|
||||
UPDATE api_scenario
|
||||
SET latest = 0
|
||||
WHERE ref_id = #{refId}
|
||||
</update>
|
||||
|
||||
<update id="addLatestVersion">
|
||||
UPDATE api_scenario
|
||||
INNER JOIN ((
|
||||
SELECT tmp.id
|
||||
FROM api_scenario tmp
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id AND project_version.latest = TRUE
|
||||
WHERE ref_id = #{refId,jdbcType=VARCHAR}
|
||||
LIMIT 1
|
||||
)
|
||||
UNION
|
||||
(
|
||||
SELECT tmp.id
|
||||
FROM api_scenario tmp
|
||||
JOIN project_version
|
||||
ON tmp.project_id = project_version.project_id AND
|
||||
tmp.version_id = project_version.id
|
||||
AND NOT EXISTS(SELECT ref_id
|
||||
FROM api_scenario tmp2
|
||||
JOIN project_version
|
||||
ON tmp2.project_id =
|
||||
project_version.project_id AND
|
||||
version_id =
|
||||
project_version.id AND
|
||||
project_version.latest = TRUE
|
||||
WHERE tmp.ref_id = tmp2.ref_id)
|
||||
WHERE tmp.ref_id = #{refId,jdbcType=VARCHAR}
|
||||
ORDER BY tmp.update_time DESC
|
||||
LIMIT 1)) AS t ON api_scenario.id = t.id
|
||||
SET api_scenario.latest = TRUE
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue