fix(接口测试): 修复接口调试拖拽排序不生效的缺陷
This commit is contained in:
parent
716e5ead03
commit
4554dcec42
|
@ -17,8 +17,8 @@ public interface ExtApiDebugMapper {
|
||||||
|
|
||||||
Long getPos(@Param("userId") String userId);
|
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);
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
</select>
|
</select>
|
||||||
<select id="getPrePos" resultType="java.lang.Long">
|
<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">
|
<if test="basePos != null">
|
||||||
and `pos` < #{basePos}
|
and `pos` < #{basePos}
|
||||||
</if>
|
</if>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
<select id="getLastPos" resultType="java.lang.Long">
|
<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">
|
<if test="basePos != null">
|
||||||
and `pos` > #{basePos}
|
and `pos` > #{basePos}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
FROM api_debug
|
FROM api_debug
|
||||||
WHERE create_user = #{userId}
|
WHERE create_user = #{userId}
|
||||||
|
|
||||||
ORDER BY update_time DESC
|
ORDER BY pos ASC
|
||||||
</select>
|
</select>
|
||||||
<select id="countModuleIdByKeywordAndProtocol" resultType="io.metersphere.project.dto.ModuleCountDTO">
|
<select id="countModuleIdByKeywordAndProtocol" resultType="io.metersphere.project.dto.ModuleCountDTO">
|
||||||
SELECT f.module_id AS moduleId, count(f.id) AS dataCount
|
SELECT f.module_id AS moduleId, count(f.id) AS dataCount
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
FROM api_definition
|
FROM api_definition
|
||||||
where api_definition.deleted = #{deleted}
|
where api_definition.deleted = #{deleted}
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereCondition"/>
|
||||||
ORDER BY update_time DESC
|
ORDER BY pos ASC
|
||||||
</select>
|
</select>
|
||||||
<select id="countModuleIdByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO">
|
<select id="countModuleIdByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO">
|
||||||
SELECT module_id AS moduleId, count(id) AS dataCount
|
SELECT module_id AS moduleId, count(id) AS dataCount
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class ApiDebugService {
|
||||||
apiDebug.setCreateTime(System.currentTimeMillis());
|
apiDebug.setCreateTime(System.currentTimeMillis());
|
||||||
apiDebug.setUpdateTime(System.currentTimeMillis());
|
apiDebug.setUpdateTime(System.currentTimeMillis());
|
||||||
apiDebug.setUpdateUser(apiDebug.getCreateUser());
|
apiDebug.setUpdateUser(apiDebug.getCreateUser());
|
||||||
apiDebug.setPos(getNextOrder(request.getProjectId()));
|
apiDebug.setPos(getNextOrder(createUser));
|
||||||
|
|
||||||
apiDebugMapper.insert(apiDebug);
|
apiDebugMapper.insert(apiDebug);
|
||||||
ApiDebugBlob apiDebugBlob = new ApiDebugBlob();
|
ApiDebugBlob apiDebugBlob = new ApiDebugBlob();
|
||||||
|
@ -103,8 +103,8 @@ public class ApiDebugService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Long getNextOrder(String projectId) {
|
private Long getNextOrder(String userId) {
|
||||||
Long pos = extApiDebugMapper.getPos(projectId);
|
Long pos = extApiDebugMapper.getPos(userId);
|
||||||
return (pos == null ? 0 : pos) + ORDER_STEP;
|
return (pos == null ? 0 : pos) + ORDER_STEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,6 +237,7 @@ public class ApiDebugService {
|
||||||
if (StringUtils.equals(request.getTargetId(), request.getMoveId())) {
|
if (StringUtils.equals(request.getTargetId(), request.getMoveId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
request.setProjectId(userId);
|
||||||
ServiceUtils.updatePosField(request,
|
ServiceUtils.updatePosField(request,
|
||||||
ApiDebug.class,
|
ApiDebug.class,
|
||||||
apiDebugMapper::selectByPrimaryKey,
|
apiDebugMapper::selectByPrimaryKey,
|
||||||
|
|
Loading…
Reference in New Issue