diff --git a/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java b/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java index acdd872aab..6ebfbf5220 100644 --- a/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/QueryAPIReportRequest.java @@ -1,8 +1,12 @@ package io.metersphere.api.dto; +import io.metersphere.controller.request.OrderRequest; import lombok.Getter; import lombok.Setter; +import java.util.List; +import java.util.Map; + @Getter @Setter public class QueryAPIReportRequest { @@ -12,5 +16,6 @@ public class QueryAPIReportRequest { private String name; private String workspaceId; private boolean recent = false; - + private List orders; + private Map> filters; } diff --git a/backend/src/main/java/io/metersphere/api/service/APIReportService.java b/backend/src/main/java/io/metersphere/api/service/APIReportService.java index 56916e1bbe..3fbd7c11e2 100644 --- a/backend/src/main/java/io/metersphere/api/service/APIReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/APIReportService.java @@ -11,12 +11,14 @@ import io.metersphere.base.mapper.ApiTestReportMapper; import io.metersphere.base.mapper.ext.ExtApiTestReportMapper; import io.metersphere.commons.constants.APITestStatus; import io.metersphere.commons.exception.MSException; +import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.dto.DashboardTestDTO; import io.metersphere.i18n.Translator; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.nio.charset.StandardCharsets; import java.time.Instant; import java.time.temporal.ChronoUnit; @@ -24,8 +26,6 @@ import java.util.List; import java.util.Objects; import java.util.UUID; -import javax.annotation.Resource; - @Service @Transactional(rollbackFor = Exception.class) public class APIReportService { @@ -38,6 +38,7 @@ public class APIReportService { private ExtApiTestReportMapper extApiTestReportMapper; public List list(QueryAPIReportRequest request) { + request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); return extApiTestReportMapper.list(request); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml index f4fbacef30..6d0700e3cb 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestReportMapper.xml @@ -26,8 +26,23 @@ AND project.workspace_id = #{request.workspaceId,jdbcType=VARCHAR} + + + + and r.${key} in + + #{value} + + + + - ORDER BY r.update_time DESC + + order by + + r.${order.name} ${order.type} + +