测试用例默认按更新时间排序

This commit is contained in:
chenjianxing 2020-05-26 19:45:08 +08:00
parent da32ae5a84
commit bae5d95371
4 changed files with 29 additions and 2 deletions

View File

@ -0,0 +1,21 @@
package io.metersphere.commons.utils;
import io.metersphere.controller.request.OrderRequest;
import java.util.ArrayList;
import java.util.List;
public class ServiceUtils {
public static List<OrderRequest> getDefaultOrder(List<OrderRequest> orders) {
if (orders == null || orders.size() < 1) {
OrderRequest orderRequest = new OrderRequest();
orderRequest.setName("update_time");
orderRequest.setType("desc");
orders = new ArrayList<>();
orders.add(orderRequest);
return orders;
}
return orders;
}
}

View File

@ -10,7 +10,9 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.excel.domain.ExcelErrData;
import io.metersphere.excel.domain.ExcelResponse;
import io.metersphere.excel.domain.TestCaseExcelData;
@ -101,6 +103,7 @@ public class TestCaseService {
}
public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return extTestCaseMapper.list(request);
}

View File

@ -7,7 +7,9 @@ import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestPlanCaseDTO;
@ -41,6 +43,7 @@ public class TestPlanTestCaseService {
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
public List<TestPlanCaseDTO> list(QueryTestPlanCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.list(request);
QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());

View File

@ -19,12 +19,12 @@
<el-col :span="12">
<span>{{$t('report.test_start_time')}}</span>
<span v-if="!isReport">{{reportInfo.startTime}}</span>
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('test_track.commons.select_date')" v-model="reportInfo.startTime"/>
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.startTime"/>
</el-col>
<el-col :span="12">
<span>{{$t('report.test_end_time')}}</span>
<span v-if="!isReport">{{reportInfo.endTime}}</span>
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('test_track.commons.select_date')" v-model="reportInfo.endTime"/>
<el-date-picker v-if="isReport" size="mini" type="date" :placeholder="$t('commons.select_date')" v-model="reportInfo.endTime"/>
</el-col>
</el-row>