fix(测试跟踪): 关联用例弹窗关键字搜索问题

--bug=1028219 --user=宋昌昌 【测试跟踪】用例评审-关联用例-根据名称搜索不准确 https://www.tapd.cn/55049933/s/1414422
This commit is contained in:
song-cc-rock 2023-09-11 13:52:56 +08:00 committed by 刘瑞斌
parent 8dc8799a08
commit 75964efc2b
9 changed files with 34 additions and 12 deletions

View File

@ -213,9 +213,13 @@
</if>
<if test="request.name != null">
and (test_case.name like CONCAT('%', #{request.name},'%')
or test_case.num like CONCAT('%', #{request.name},'%')
or test_case.tags like CONCAT('%', #{request.name},'%')
or test_case.custom_num like CONCAT('%', #{request.name},'%'))
<if test="request.customNum">
or test_case.custom_num like CONCAT('%', #{request.name},'%')
</if>
<if test="!request.customNum">
or test_case.num like CONCAT('%', #{request.name},'%')
</if>
or test_case.tags like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.projectId != null">
AND test_case.project_id = #{request.projectId}

View File

@ -26,6 +26,9 @@ import io.metersphere.service.FileService;
import io.metersphere.service.TestCaseService;
import io.metersphere.service.wapper.CheckPermissionService;
import io.metersphere.xpack.track.dto.EditTestCaseRequest;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -35,9 +38,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
@ -142,6 +142,7 @@ public class TestCaseController {
@PostMapping("/relate/{goPage}/{pageSize}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ)
public Pager<List<TestCaseDTO>> getTestCaseRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
testCaseService.setRequestCustomNumParam(request);
return testCaseService.getTestCaseRelateList(request, goPage, pageSize);
}
@ -181,6 +182,7 @@ public class TestCaseController {
@PostMapping("/reviews/case/{goPage}/{pageSize}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ)
public Pager<List<TestCaseDTO>> getReviewCase(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
testCaseService.setRequestCustomNumParam(request);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseService.getReviewCase(request));
}

View File

@ -73,4 +73,9 @@ public class QueryTestCaseRequest extends BaseQueryRequest {
* 是否待办状态
*/
private boolean unComing;
/**
* 是否开启了用例自定义ID选项
*/
private boolean customNum;
}

View File

@ -3508,6 +3508,14 @@ public class TestCaseService {
}
}
public void setRequestCustomNumParam(QueryTestCaseRequest request) {
Project project = baseProjectService.getProjectById(request.getProjectId());
if (project != null) {
ProjectConfig config = baseProjectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
request.setCustomNum(config.getCaseCustomNum());
}
}
/**
* 是否包含超级管理员用户组(当前登录用户)
*

View File

@ -21,7 +21,7 @@
ref="nodeTree"/>
</template>
<ms-table-header :condition.sync="page.condition" @search="search" title="" :show-create="false">
<ms-table-header :condition.sync="page.condition" @search="search" title="" :show-create="false" :tip="$t('review.search_by_id_or_name_or_tag')">
<template v-slot:searchBarBefore>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/>
</template>

View File

@ -42,10 +42,10 @@
:tree-nodes="treeNodes"
ref="nodeTree"/>
</ms-aside-container>
<el-container>
<el-main class="case-content">
<ms-table-header :tip="$t('commons.search_by_name_or_id')" :condition.sync="condition" @search="search"
<ms-table-header :tip="$t('review.search_by_id_or_name_or_tag')" :condition.sync="condition" @search="search"
title="" :show-create="false">
<template v-slot:searchBarBefore>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20"/>

View File

@ -81,7 +81,8 @@ const message = {
please_input_review_comment: "Please enter the review comments",
pass_review_confirm: "Are you sure to pass this review",
comment_require: "(require)",
comment_not_require: "(not_require)"
comment_not_require: "(not_require)",
search_by_id_or_name_or_tag: "Search by ID/Name/Tag"
},
case: {
all_case_content: "All case",

View File

@ -81,7 +81,8 @@ const message = {
please_input_review_comment: "请输入评审意见",
pass_review_confirm: "确定通过此评审吗",
comment_require: "(必填)",
comment_not_require: "(选填)"
comment_not_require: "(选填)",
search_by_id_or_name_or_tag: "通过ID/名称/标签搜索"
},
case: {
all_case_content: "全部用例",

View File

@ -81,7 +81,8 @@ const message = {
please_input_review_comment: "請輸入評審意見",
pass_review_confirm: "確定通過此評審嗎",
comment_require: "(必填)",
comment_not_require: "(選填)"
comment_not_require: "(選填)",
search_by_id_or_name_or_tag: "通過ID/名稱/標籤搜索"
},
case: {
all_case_content: "全部用例",