fix: 初始化排序应该按照更新顺序而不是创建顺序

This commit is contained in:
chenjianxing 2021-09-09 17:35:39 +08:00 committed by jianxing
parent b54fd8e36a
commit 54a2147f8d
13 changed files with 19 additions and 19 deletions

View File

@ -2508,7 +2508,7 @@ public class ApiAutomationService {
public void initOrderField() {
ServiceUtils.initOrderField(ApiScenarioWithBLOBs.class, ApiScenarioMapper.class,
extApiScenarioMapper::selectProjectIds,
extApiScenarioMapper::getIdsOrderByCreateTime);
extApiScenarioMapper::getIdsOrderByUpdateTime);
}
/**

View File

@ -1025,7 +1025,7 @@ public class ApiTestCaseService {
public void initOrderField() {
ServiceUtils.initOrderField(ApiTestCaseWithBLOBs.class, ApiTestCaseMapper.class,
extApiTestCaseMapper::selectProjectIds,
extApiTestCaseMapper::getIdsOrderByCreateTime);
extApiTestCaseMapper::getIdsOrderByUpdateTime);
}
/**

View File

@ -75,7 +75,7 @@ public interface ExtApiScenarioMapper {
List<String> selectProjectIds();
List<String> getIdsOrderByCreateTime(@Param("projectId") String projectId);
List<String> getIdsOrderByUpdateTime(@Param("projectId") String projectId);
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);

View File

@ -464,8 +464,8 @@
<select id="selectProjectIds" resultType="java.lang.String">
select DISTINCT project_id from api_scenario;
</select>
<select id="getIdsOrderByCreateTime" resultType="java.lang.String">
select id from api_scenario where project_id = #{projectId} order by create_time ASC;
<select id="getIdsOrderByUpdateTime" resultType="java.lang.String">
select id from api_scenario where project_id = #{projectId} order by update_time ASC;
</select>
<select id="getLastOrder" resultType="java.lang.Long">

View File

@ -55,7 +55,7 @@ public interface ExtApiTestCaseMapper {
List<String> selectProjectIds();
List<String> getIdsOrderByCreateTime(@Param("projectId") String projectId);
List<String> getIdsOrderByUpdateTime(@Param("projectId") String projectId);
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);

View File

@ -579,8 +579,8 @@
<select id="selectProjectIds" resultType="java.lang.String">
select DISTINCT project_id from api_test_case;
</select>
<select id="getIdsOrderByCreateTime" resultType="java.lang.String">
select id from api_test_case where project_id = #{projectId} order by create_time ASC;
<select id="getIdsOrderByUpdateTime" resultType="java.lang.String">
select id from api_test_case where project_id = #{projectId} order by update_time ASC;
</select>
<select id="getPreOrder" resultType="java.lang.Long">
select `order` from api_test_case where project_id = #{projectId}

View File

@ -24,7 +24,7 @@ public interface ExtLoadTestMapper {
List<String> selectProjectIds();
List<String> getIdsOrderByCreateTime(@Param("projectId") String projectId);
List<String> getIdsOrderByUpdateTime(@Param("projectId") String projectId);
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);

View File

@ -160,8 +160,8 @@
<select id="selectProjectIds" resultType="java.lang.String">
select DISTINCT project_id from load_test;
</select>
<select id="getIdsOrderByCreateTime" resultType="java.lang.String">
select id from load_test where project_id = #{projectId} order by create_time ASC;
<select id="getIdsOrderByUpdateTime" resultType="java.lang.String">
select id from load_test where project_id = #{projectId} order by update_time ASC;
</select>
<select id="getLastOrder" resultType="java.lang.Long">

View File

@ -113,7 +113,7 @@ public interface ExtTestCaseMapper {
List<String> selectProjectIds();
List<String> getIdsOrderByCreateTime(@Param("projectId") String projectId);
List<String> getIdsOrderByUpdateTime(@Param("projectId") String projectId);
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);

View File

@ -533,8 +533,8 @@
<select id="selectProjectIds" resultType="java.lang.String">
select DISTINCT project_id from test_case;
</select>
<select id="getIdsOrderByCreateTime" resultType="java.lang.String">
select id from test_case where project_id = #{projectId} order by create_time ASC;
<select id="getIdsOrderByUpdateTime" resultType="java.lang.String">
select id from test_case where project_id = #{projectId} order by update_time ASC;
</select>
<select id="getLastOrder" resultType="java.lang.Long">

View File

@ -121,13 +121,13 @@ public class ServiceUtils {
* @param clazz
* @param mapClazz
* @param selectProjectIdsFunc
* @param getIdsOrderByCreateTimeFunc
* @param getIdsOrderByUpdateTimeFunc
* @param <T>
* @param <M>
*/
public static <T, M> void initOrderField(Class<T> clazz, Class<M> mapClazz,
Supplier<List<String>> selectProjectIdsFunc,
Function<String, List<String>> getIdsOrderByCreateTimeFunc) {
Function<String, List<String>> getIdsOrderByUpdateTimeFunc) {
try {
@ -140,7 +140,7 @@ public class ServiceUtils {
List<String> projectIds = selectProjectIdsFunc.get();
for (String projectId : projectIds) {
Long order = 0L;
List<String> ids = getIdsOrderByCreateTimeFunc.apply(projectId);
List<String> ids = getIdsOrderByUpdateTimeFunc.apply(projectId);
for (String id : ids) {
T item = clazz.newInstance();
setId.invoke(item, id);

View File

@ -869,7 +869,7 @@ public class PerformanceTestService {
public void initOrderField() {
ServiceUtils.initOrderField(LoadTestWithBLOBs.class, LoadTestMapper.class,
extLoadTestMapper::selectProjectIds,
extLoadTestMapper::getIdsOrderByCreateTime);
extLoadTestMapper::getIdsOrderByUpdateTime);
}
/**

View File

@ -1894,7 +1894,7 @@ public class TestCaseService {
public void initOrderField() {
ServiceUtils.initOrderField(TestCaseWithBLOBs.class, TestCaseMapper.class,
extTestCaseMapper::selectProjectIds,
extTestCaseMapper::getIdsOrderByCreateTime);
extTestCaseMapper::getIdsOrderByUpdateTime);
}
/**