refactor(工作台): 功能优化

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-07-24 16:20:46 +08:00 committed by xiaomeinvG
parent 2b017ba90e
commit 71586e321e
10 changed files with 79 additions and 6 deletions

View File

@ -36,4 +36,10 @@ public class ApiDefinitionRequest extends BaseQueryRequest {
//当前时间减去进入待更新的时间
private Long toBeUpdateTime;
//同步配置
private ApiSyncCaseRequest syncConfig;
//全选
private boolean selectAll;
}

View File

@ -34,4 +34,6 @@ public class ApiSyncCaseRequest {
private Boolean unRun;
private List<String> ids;
private Boolean selectAll;
}

View File

@ -58,4 +58,10 @@ public class ApiTestCaseRequest extends BaseQueryRequest {
//页面跳转时附带的过滤条件
private String redirectFilter;
//同步配置
private ApiSyncCaseRequest syncConfig;
//全选
private boolean selectAll;
}

View File

@ -985,9 +985,26 @@ public class ApiDefinitionService {
}
if (apiDefinition.getToBeUpdated() != null) {
apiTestCaseWithBLOBs.setToBeUpdated(apiDefinition.getToBeUpdated());
}
ApiSyncCaseRequest apiSyncCaseRequest = new ApiSyncCaseRequest();
ApiDefinitionSyncService apiDefinitionSyncService = CommonBeanFactory.getBean(ApiDefinitionSyncService.class);
if (apiDefinitionSyncService != null) {
apiSyncCaseRequest = apiDefinitionSyncService.getApiSyncCaseRequest(apiDefinition.getProjectId());
}
if (apiSyncCaseRequest.getUnRun() != null && apiSyncCaseRequest.getUnRun() && apiTestCaseWithBLOBs.getStatus() != null && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Trash")
&& !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("success") && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("error")
&& !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Running") && !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("errorReportResult")
&& !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("STOP")) {
apiTestCaseWithBLOBs.setToBeUpdated(true);
} else if (apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCaseWithBLOBs.getStatus() != null
&& !apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("Trash")
&& apiTestCaseWithBLOBs.getStatus().equalsIgnoreCase("error")) {
apiTestCaseWithBLOBs.setToBeUpdated(true);
} else {
apiTestCaseWithBLOBs.setToBeUpdated(false);
}
}
if (apiDefinition.getToBeUpdateTime() != null) {
apiTestCaseWithBLOBs.setToBeUpdateTime(apiDefinition.getToBeUpdateTime());
}

View File

@ -865,9 +865,13 @@ public class ApiTestCaseService {
apiTestCase.setToBeUpdated(true);
} else
apiTestCase.setToBeUpdated(apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash")
&& !apiTestCase.getStatus().equalsIgnoreCase("error"));
} else if (apiSyncCaseRequest.getRunError() != null && apiSyncCaseRequest.getRunError() && apiTestCase.getStatus() != null && !apiTestCase.getStatus().equalsIgnoreCase("Trash")
&& apiTestCase.getStatus().equalsIgnoreCase("error")) {
apiTestCase.setToBeUpdated(true);
} else {
apiTestCase.setToBeUpdated(false);
}
if (toBeUpdated) {
apiTestCase.setToBeUpdateTime(System.currentTimeMillis());
}

View File

@ -23,6 +23,8 @@ public interface ExtApiDefinitionMapper {
List<ApiDefinitionResult> list(@Param("request") ApiDefinitionRequest request);
List<ApiDefinitionWithBLOBs> apiList(@Param("request") ApiDefinitionRequest request);
List<ApiDefinitionResult> weekList(@Param("request") ApiDefinitionRequest request, @Param("startTimestamp") long startTimestamp);
List<Scenario> scenarioList(@Param("apiDefinitionId") String apiDefinitionId);

View File

@ -1116,6 +1116,24 @@
and project_id = #{projectId}
and status != 'Trash'
</select>
<select id="apiList" resultType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
select * from api_definition
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<if test="order.name == 'user_name'">
user_name ${order.type}
</if>
<if test="order.name == 'case_total'">
CONVERT(api_definition.${order.name},SIGNED) ${order.type}
</if>
<if test="order.name != 'user_name' and order.name != 'case_total'">
api_definition.${order.name} ${order.type}
</if>
</foreach>
</if>
</select>
<sql id="Same_Where_Clause">
<where>
<if test="blobs">

View File

@ -5,6 +5,7 @@ import io.metersphere.api.dto.datacount.response.ExecuteResultCountDTO;
import io.metersphere.api.dto.definition.*;
import io.metersphere.base.domain.ApiDefinition;
import io.metersphere.base.domain.ApiTestCase;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -13,6 +14,8 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCaseResult> list(@Param("request") ApiTestCaseRequest request);
List<ApiTestCaseWithBLOBs> caseList(@Param("request") ApiTestCaseRequest request);
List<ApiTestCaseDTO> listSimple(@Param("request") ApiTestCaseRequest request);
List<String> selectIdsNotExistsInPlan(@Param("projectId") String projectId, @Param("planId") String planId);

View File

@ -946,4 +946,19 @@
AND latest = 1)
GROUP BY `status`
</select>
<select id="caseList" resultType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
SELECT
t1.*,
a.method AS apiMethod
FROM
api_test_case t1
inner join api_definition a on t1.api_definition_id = a.id
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
t1.${order.name} ${order.type}
</foreach>
</if>
</select>
</mapper>

View File

@ -521,7 +521,7 @@ export default {
this.httpForm.versionId = this.$refs.versionHistory.currentVersion.id;
}
}
if (hasLicense() && this.httpForm.caseTotal > 0) {
if (hasLicense() && this.httpForm.caseTotal > 0 && !this.httpForm.isCopy) {
if (this.apiSyncCaseRequest && this.apiSyncCaseRequest.method) {
if (this.httpForm.method !== this.beforeHttpForm.method) {