This commit is contained in:
wenyann 2020-06-02 15:33:52 +08:00
parent ffaefb3985
commit 6e3d551a01
3 changed files with 23 additions and 3 deletions

View File

@ -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 QueryAPITestRequest {
@ -12,5 +16,7 @@ public class QueryAPITestRequest {
private String name;
private String workspaceId;
private boolean recent = false;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
}

View File

@ -134,7 +134,6 @@ public class APITestService {
apiTestMapper.updateByPrimaryKeySelective(test);
return test;
}
private ApiTestWithBLOBs createTest(SaveAPITestRequest request) {
ApiTestExample example = new ApiTestExample();
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId());

View File

@ -26,8 +26,23 @@
<if test="request.id != null">
AND api_test.id = #{request.id}
</if>
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
and api_test.${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</foreach>
</if>
</where>
order by api_test.update_time desc
<if test="reportRequest.orders != null and reportRequest.orders.size() > 0">
order by
<foreach collection="reportRequest.orders" separator="," item="order">
api_test.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="countByProjectId" resultType="java.lang.Long">
select count(id) from api_test