fix(测试跟踪):修复功能用例高级搜索id查询条件不生效问题

--bug=1025833 --user=王旭 【测试跟踪】功能用例-高级搜索-按id筛选-结果不正确 https://www.tapd.cn/55049933/s/1368576
This commit is contained in:
WangXu10 2023-05-05 15:14:27 +08:00 committed by jianxing
parent 31044cc2db
commit ab50325678
2 changed files with 15 additions and 8 deletions

View File

@ -9,16 +9,17 @@
<property name="object" value="${condition}.name"/>
</include>
</if>
<if test='${condition}.id != null'>
and (test_case.num
<if test='${condition}.id != null and ${condition}.caseCustomNum != "true"'>
and test_case.num
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.id"/>
</include>
or test_case.custom_num
</if>
<if test='${condition}.id != null and ${condition}.caseCustomNum == "true"'>
and test_case.custom_num
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
<property name="object" value="${condition}.id"/>
</include>
)
</if>
<if test="${condition}.followPeople != null">
and test_case.id in (

View File

@ -3,13 +3,11 @@ package io.metersphere.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.ProjectApplication;
import io.metersphere.base.domain.TestCase;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.constants.*;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
@ -21,6 +19,7 @@ import io.metersphere.request.ResetOrderRequest;
import io.metersphere.request.testcase.*;
import io.metersphere.request.testplan.FileOperationRequest;
import io.metersphere.service.BaseCheckPermissionService;
import io.metersphere.service.BaseProjectApplicationService;
import io.metersphere.service.FileService;
import io.metersphere.service.TestCaseService;
import io.metersphere.service.wapper.CheckPermissionService;
@ -55,9 +54,16 @@ public class TestCaseController {
@Resource
private FileService fileService;
@Resource
private BaseProjectApplicationService projectApplicationService;
@PostMapping("/list/{goPage}/{pageSize}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_CASE_READ)
public Pager<List<TestCaseDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
ProjectApplication projectApplication = projectApplicationService.getProjectApplication(request.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
if (projectApplication != null && StringUtils.isNotEmpty(projectApplication.getTypeValue()) && request.getCombine() != null) {
request.getCombine().put("caseCustomNum", projectApplication.getTypeValue());
}
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseService.listTestCase(request));
}