fix(接口测试): 修复接口调试拖拽排序不生效的缺陷

This commit is contained in:
wxg0103 2024-02-21 19:02:38 +08:00 committed by Craftsman
parent 716e5ead03
commit 4554dcec42
5 changed files with 10 additions and 9 deletions

View File

@ -17,8 +17,8 @@ public interface ExtApiDebugMapper {
Long getPos(@Param("userId") String userId);
Long getPrePos(@Param("projectId") String projectId, @Param("basePos") Long basePos);
Long getPrePos(@Param("userId") String userId, @Param("basePos") Long basePos);
Long getLastPos(@Param("projectId") String projectId, @Param("basePos") Long basePos);
Long getLastPos(@Param("userId") String userId, @Param("basePos") Long basePos);
}

View File

@ -18,7 +18,7 @@
LIMIT 1;
</select>
<select id="getPrePos" resultType="java.lang.Long">
select `pos` from api_debug where project_id = #{projectId}
select `pos` from api_debug where create_user = #{userId}
<if test="basePos != null">
and `pos` &lt; #{basePos}
</if>
@ -27,7 +27,7 @@
<select id="getLastPos" resultType="java.lang.Long">
select `pos` from api_debug where project_id = #{projectId}
select `pos` from api_debug where create_user = #{userId}
<if test="basePos != null">
and `pos` &gt; #{basePos}
</if>

View File

@ -54,7 +54,7 @@
FROM api_debug
WHERE create_user = #{userId}
ORDER BY update_time DESC
ORDER BY pos ASC
</select>
<select id="countModuleIdByKeywordAndProtocol" resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT f.module_id AS moduleId, count(f.id) AS dataCount

View File

@ -46,7 +46,7 @@
FROM api_definition
where api_definition.deleted = #{deleted}
<include refid="queryWhereCondition"/>
ORDER BY update_time DESC
ORDER BY pos ASC
</select>
<select id="countModuleIdByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT module_id AS moduleId, count(id) AS dataCount

View File

@ -86,7 +86,7 @@ public class ApiDebugService {
apiDebug.setCreateTime(System.currentTimeMillis());
apiDebug.setUpdateTime(System.currentTimeMillis());
apiDebug.setUpdateUser(apiDebug.getCreateUser());
apiDebug.setPos(getNextOrder(request.getProjectId()));
apiDebug.setPos(getNextOrder(createUser));
apiDebugMapper.insert(apiDebug);
ApiDebugBlob apiDebugBlob = new ApiDebugBlob();
@ -103,8 +103,8 @@ public class ApiDebugService {
}
private Long getNextOrder(String projectId) {
Long pos = extApiDebugMapper.getPos(projectId);
private Long getNextOrder(String userId) {
Long pos = extApiDebugMapper.getPos(userId);
return (pos == null ? 0 : pos) + ORDER_STEP;
}
@ -237,6 +237,7 @@ public class ApiDebugService {
if (StringUtils.equals(request.getTargetId(), request.getMoveId())) {
return;
}
request.setProjectId(userId);
ServiceUtils.updatePosField(request,
ApiDebug.class,
apiDebugMapper::selectByPrimaryKey,