fix(接口测试): 接口测试首页定时任务表格增加按照修改时间排序功能

--bug=1025104 --user=宋天阳 【接口测试】接口测试首页-运行中的定时任务列表排序没有规则
https://www.tapd.cn/55049933/s/1359129
This commit is contained in:
song-tianyang 2023-04-04 12:13:36 +08:00 committed by fit2-zhao
parent 9b9e11ff2b
commit 8b350b9fe0
1 changed files with 33 additions and 31 deletions

View File

@ -55,10 +55,10 @@
SELECT COUNT(id) AS countNumber SELECT COUNT(id) AS countNumber
FROM `schedule` FROM `schedule`
WHERE resource_id IN ( WHERE resource_id IN (
SELECT scene.id SELECT scene.id
FROM api_scenario scene FROM api_scenario scene
WHERE scene.project_id = #{projectId,jdbcType=VARCHAR} WHERE scene.project_id = #{projectId,jdbcType=VARCHAR}
AND scene.status != 'Trash' AND scene.status != 'Trash'
<if test="versionId != null"> <if test="versionId != null">
AND version_id = #{versionId} AND version_id = #{versionId}
</if> </if>
@ -66,29 +66,29 @@
AND latest = 1 AND latest = 1
</if> </if>
) )
AND create_time BETWEEN #{startTime} AND #{endTime} AND create_time BETWEEN #{startTime} AND #{endTime}
</select> </select>
<select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.dto.TaskInfoResult"> <select id="findRunningTaskInfoByProjectID" resultType="io.metersphere.dto.TaskInfoResult">
SELECT sch.id AS taskID, SELECT sch.id AS taskID,
sch.`name` AS `name`, sch.`name` AS `name`,
sch.`value` AS rule, sch.`value` AS rule,
sch.`enable` AS `taskStatus`, sch.`enable` AS `taskStatus`,
sch.update_time AS updateTime, sch.update_time AS updateTime,
sch.id AS taskID, sch.id AS taskID,
sch.`value` AS rule, sch.`value` AS rule,
sch.`enable` AS `taskStatus`, sch.`enable` AS `taskStatus`,
u.`name` AS creator, u.`name` AS creator,
sch.update_time AS updateTime, sch.update_time AS updateTime,
sch.type AS taskType, sch.type AS taskType,
sch.`group` AS taskGroup, sch.`group` AS taskGroup,
sch.resource_id AS scenarioId sch.resource_id AS scenarioId
FROM ( FROM (
schedule sch left join user u schedule sch left join user u
ON sch.user_id = u.id ON sch.user_id = u.id
) )
WHERE sch.`enable` = true WHERE sch.`enable` = true
AND sch.project_id = #{projectId,jdbcType=VARCHAR} AND sch.project_id = #{projectId,jdbcType=VARCHAR}
<if test="request.filters != null and request.filters.size() > 0"> <if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values"> <foreach collection="request.filters.entrySet()" index="key" item="values">
@ -109,24 +109,23 @@
<select id="findScenarioAndSwaggerRunningTaskInfoByProjectID" resultType="io.metersphere.dto.TaskInfoResult"> <select id="findScenarioAndSwaggerRunningTaskInfoByProjectID" resultType="io.metersphere.dto.TaskInfoResult">
SELECT sch.id AS taskID, SELECT sch.id AS taskID,
sch.`name` AS `name`, sch.`name` AS `name`,
sch.`value` AS rule, sch.`value` AS rule,
sch.`enable` AS `taskStatus`, sch.`enable` AS `taskStatus`,
sch.update_time AS updateTime, sch.update_time AS updateTime,
sch.id AS taskID, sch.id AS taskID,
sch.`value` AS rule, sch.`value` AS rule,
sch.`enable` AS `taskStatus`, sch.`enable` AS `taskStatus`,
u.`name` AS creator, u.`name` AS creator,
sch.update_time AS updateTime, sch.update_time AS updateTime,
sch.type AS taskType, sch.type AS taskType,
sch.`group` AS taskGroup, sch.`group` AS taskGroup,
sch.resource_id AS scenarioId sch.resource_id AS scenarioId
FROM ( FROM (
schedule sch left join user u schedule sch left join user u
ON sch.user_id = u.id ON sch.user_id = u.id
) )
WHERE sch.`enable` = true WHERE sch.`enable` = true
AND sch.project_id = #{projectId,jdbcType=VARCHAR} AND sch.project_id = #{projectId,jdbcType=VARCHAR}
<if test="versionId != null"> <if test="versionId != null">
AND ( AND (
sch.group IN ('SWAGGER_IMPORT') sch.group IN ('SWAGGER_IMPORT')
@ -137,8 +136,11 @@
<if test="versionId == null"> <if test="versionId == null">
AND sch.group IN ('API_SCENARIO_TEST','SWAGGER_IMPORT') AND sch.group IN ('API_SCENARIO_TEST','SWAGGER_IMPORT')
</if> </if>
ORDER BY sch.update_time DESC
</select> </select>
<update id="updateNameByResourceID"> <update id="updateNameByResourceID">
update schedule set name = #{name} where resource_id = #{resourceId} update schedule
set name = #{name}
where resource_id = #{resourceId}
</update> </update>
</mapper> </mapper>