fix(测试跟踪): 修复case导出后,xls打开顺序不一致

This commit is contained in:
wenyann 2020-08-03 14:52:03 +08:00
parent 7cbb202309
commit cb58177c62
3 changed files with 15 additions and 1 deletions

View File

@ -235,7 +235,12 @@
</foreach> </foreach>
</if> </if>
</where> </where>
order by update_time desc <if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
${order.name} ${order.type}
</foreach>
</if>
</select> </select>
<select id="getMaxNumByProjectId" resultType="io.metersphere.base.domain.TestCase"> <select id="getMaxNumByProjectId" resultType="io.metersphere.base.domain.TestCase">

View File

@ -1,6 +1,7 @@
package io.metersphere.track.request.testcase; package io.metersphere.track.request.testcase;
import io.metersphere.base.domain.TestCaseWithBLOBs; import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.controller.request.OrderRequest;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -10,4 +11,5 @@ import java.util.List;
@Setter @Setter
public class TestCaseBatchRequest extends TestCaseWithBLOBs { public class TestCaseBatchRequest extends TestCaseWithBLOBs {
private List<String> ids; private List<String> ids;
private List<OrderRequest> orders;
} }

View File

@ -356,6 +356,12 @@ public class TestCaseService {
} }
private List<TestCaseExcelData> generateTestCaseExcel(TestCaseBatchRequest request) { private List<TestCaseExcelData> generateTestCaseExcel(TestCaseBatchRequest request) {
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest();
order.setName("sort");
order.setType("desc");
orderList.add(order);
request.setOrders(orderList);
List<TestCaseDTO> TestCaseList = extTestCaseMapper.listByTestCaseIds(request); List<TestCaseDTO> TestCaseList = extTestCaseMapper.listByTestCaseIds(request);
List<TestCaseExcelData> list = new ArrayList<>(); List<TestCaseExcelData> list = new ArrayList<>();
StringBuilder step = new StringBuilder(""); StringBuilder step = new StringBuilder("");
@ -466,6 +472,7 @@ public class TestCaseService {
/** /**
* 导入用例前检查数据库是否存在此用例 * 导入用例前检查数据库是否存在此用例
*
* @param testCaseWithBLOBs * @param testCaseWithBLOBs
* @return * @return
*/ */