feat(用例管理): 测试计划功能点脑图增加用例字段的排序

This commit is contained in:
guoyuqi 2024-11-05 10:20:42 +08:00 committed by Craftsman
parent bf765e6c51
commit 9e5b3208b7
5 changed files with 13 additions and 16 deletions

View File

@ -104,7 +104,7 @@ public interface ExtFunctionalCaseMapper {
List<FunctionalCaseMindDTO> getMinderTestPlanList(@Param("request") FunctionalCasePlanMindRequest request, @Param("deleted") boolean delete, @Param("sort") String sort);
List<FunctionalCaseMindDTO> getMinderCollectionList(@Param("request") FunctionalCaseCollectionMindRequest request, @Param("deleted") boolean delete);
List<FunctionalCaseMindDTO> getMinderCollectionList(@Param("request") FunctionalCaseCollectionMindRequest request, @Param("deleted") boolean delete, @Param("sort") String sort);
List<BaseTreeNode> selectBaseMindNodeByProjectId(@Param("projectId") String projectId);

View File

@ -828,6 +828,13 @@
AND fc.deleted = #{deleted}
AND
tpfc.test_plan_collection_id = #{request.collectionId}
order by
<if test="sort != null and sort != ''">
fc.${sort}
</if>
<if test="sort == null or sort == ''">
fc.pos desc
</if>
</select>
<select id="selectBaseMindNodeByProjectId" resultType="io.metersphere.system.dto.sdk.BaseTreeNode">

View File

@ -1,27 +1,14 @@
package io.metersphere.functional.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
@Data
public class FunctionalCaseCollectionMindRequest {
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case.project_id.not_blank}")
private String projectId;
public class FunctionalCaseCollectionMindRequest extends FunctionalCasePlanMindRequest {
@Schema(description = "测试集ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String collectionId;
@Min(value = 1, message = "当前页码必须大于0")
@Schema(description = "当前页码")
private int current;
@Schema(description = "测试计划id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_functional_case.test_plan_id.not_blank}")
private String planId;
}

View File

@ -1376,7 +1376,7 @@ public class FunctionalCaseMinderService {
public List<FunctionalMinderTreeDTO> getCollectionMindFunctionalCase(FunctionalCaseCollectionMindRequest request, boolean deleted) {
List<FunctionalMinderTreeDTO> list = new ArrayList<>();
List<FunctionalCaseMindDTO> functionalCaseMindDTOList = extFunctionalCaseMapper.getMinderCollectionList(request, deleted);
List<FunctionalCaseMindDTO> functionalCaseMindDTOList = extFunctionalCaseMapper.getMinderCollectionList(request, deleted, request.getSortString());
List<String> projectIds = functionalCaseMindDTOList.stream().map(FunctionalCaseMindDTO::getProjectId).distinct().toList();
List<FunctionalCaseCustomField> caseCustomFieldList = new ArrayList<>();
for (String projectId : projectIds) {

View File

@ -530,6 +530,9 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
request.setCollectionId(collectionId);
request.setPlanId("TEST_MINDER_PLAN_ID_1");
request.setCurrent(1);
Map<String,String> map = new HashMap<>();
map.put("name", "desc");
request.setSort(map);
MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_COLLECTION_LIST_URL, request);
Pager<List<FunctionalMinderTreeDTO>> tableData = JSON.parseObject(JSON.toJSONString(
JSON.parseObject(mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),