fix(用例管理): 修复功能用例页面显示问题

--bug=1036810 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036810
--bug=1036809 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036809
--bug=1036783 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036783
--bug=1036746 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036746
--bug=1036642 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036642
This commit is contained in:
guoyuqi 2024-03-06 14:44:27 +08:00 committed by 刘瑞斌
parent 0c688bccbe
commit 8ee1f1abc3
9 changed files with 41 additions and 39 deletions

View File

@ -246,7 +246,7 @@ public class FunctionalCaseController {
@CheckOwner(resourceId = "#request.getSourceId()", resourceType = "functional_case") @CheckOwner(resourceId = "#request.getSourceId()", resourceType = "functional_case")
public Pager<List<OperationHistoryDTO>> operationHistoryList(@Validated @RequestBody OperationHistoryRequest request) { public Pager<List<OperationHistoryDTO>> operationHistoryList(@Validated @RequestBody OperationHistoryRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
org.apache.commons.lang3.StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc"); StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
return PageUtils.setPageInfo(page, functionalCaseService.operationHistoryList(request)); return PageUtils.setPageInfo(page, functionalCaseService.operationHistoryList(request));
} }
} }

View File

@ -62,7 +62,7 @@ public class FunctionalCaseModuleController {
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_DELETE) @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_DELETE)
@CheckOwner(resourceId = "#moduleId", resourceType = "functional_case_module") @CheckOwner(resourceId = "#moduleId", resourceType = "functional_case_module")
public void deleteNode(@PathVariable String moduleId) { public void deleteNode(@PathVariable String moduleId) {
functionalCaseModuleService.deleteModule(moduleId); functionalCaseModuleService.deleteModule(moduleId, SessionUtils.getUserId());
} }
@GetMapping("/trash/tree/{projectId}") @GetMapping("/trash/tree/{projectId}")

View File

@ -27,7 +27,7 @@ public interface ExtFunctionalCaseMapper {
List<String> getFunctionalCaseIds(@Param("projectId") String projectId); List<String> getFunctionalCaseIds(@Param("projectId") String projectId);
void removeToTrashByModuleIds(@Param("moduleIds") List<String> deleteIds); void removeToTrashByModuleIds(@Param("moduleIds") List<String> deleteIds, @Param("userId") String userId);
List<FunctionalCase> checkCaseByModuleIds(@Param("moduleIds") List<String> deleteIds); List<FunctionalCase> checkCaseByModuleIds(@Param("moduleIds") List<String> deleteIds);

View File

@ -77,7 +77,7 @@
</select> </select>
<update id="removeToTrashByModuleIds" parameterType="java.lang.String"> <update id="removeToTrashByModuleIds" parameterType="java.lang.String">
UPDATE functional_case SET deleted = true, module_id = 'root' WHERE module_id IN UPDATE functional_case SET deleted = true, module_id = 'root', delete_time = unix_timestamp()*1000, delete_user = #{userId} WHERE module_id IN
<foreach collection="moduleIds" item="id" open="(" separator="," close=")"> <foreach collection="moduleIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

View File

@ -117,10 +117,10 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
super.sort(nodeSortDTO); super.sort(nodeSortDTO);
} }
public void deleteModule(String moduleId) { public void deleteModule(String moduleId, String userId) {
FunctionalCaseModule deleteModule = functionalCaseModuleMapper.selectByPrimaryKey(moduleId); FunctionalCaseModule deleteModule = functionalCaseModuleMapper.selectByPrimaryKey(moduleId);
if (deleteModule != null) { if (deleteModule != null) {
List<FunctionalCase> functionalCases = this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>()); List<FunctionalCase> functionalCases = this.deleteModuleByIds(Collections.singletonList(moduleId), new ArrayList<>(), userId);
batchDelLog(functionalCases, deleteModule.getProjectId()); batchDelLog(functionalCases, deleteModule.getProjectId());
} }
} }
@ -145,7 +145,7 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
operationLogService.batchAdd(dtoList); operationLogService.batchAdd(dtoList);
} }
public List<FunctionalCase> deleteModuleByIds(List<String> deleteIds, List<FunctionalCase> functionalCases) { public List<FunctionalCase> deleteModuleByIds(List<String> deleteIds, List<FunctionalCase> functionalCases, String userId) {
if (CollectionUtils.isEmpty(deleteIds)) { if (CollectionUtils.isEmpty(deleteIds)) {
return functionalCases; return functionalCases;
} }
@ -156,10 +156,10 @@ public class FunctionalCaseModuleService extends ModuleTreeService {
if (CollectionUtils.isNotEmpty(functionalCaseList)) { if (CollectionUtils.isNotEmpty(functionalCaseList)) {
functionalCases.addAll(functionalCaseList); functionalCases.addAll(functionalCaseList);
} }
extFunctionalCaseMapper.removeToTrashByModuleIds(deleteIds); extFunctionalCaseMapper.removeToTrashByModuleIds(deleteIds, userId);
List<String> childrenIds = extFunctionalCaseModuleMapper.selectChildrenIdsByParentIds(deleteIds); List<String> childrenIds = extFunctionalCaseModuleMapper.selectChildrenIdsByParentIds(deleteIds);
if (CollectionUtils.isNotEmpty(childrenIds)) { if (CollectionUtils.isNotEmpty(childrenIds)) {
deleteModuleByIds(childrenIds, functionalCases); deleteModuleByIds(childrenIds, functionalCases, userId);
} }
return functionalCases; return functionalCases;
} }

View File

@ -702,7 +702,7 @@ public class FunctionalCaseModuleControllerTests extends BaseTest {
this.requestGetWithOk(URL_MODULE_TREE_DELETE + ModuleConstants.DEFAULT_NODE_ID); this.requestGetWithOk(URL_MODULE_TREE_DELETE + ModuleConstants.DEFAULT_NODE_ID);
//service层判断测试删除空集合 //service层判断测试删除空集合
functionalCaseModuleService.deleteModuleByIds(new ArrayList<>(), new ArrayList<>()); functionalCaseModuleService.deleteModuleByIds(new ArrayList<>(), new ArrayList<>(), "admin");
checkLog(functionalCase.getId(), OperationLogType.DELETE, URL_MODULE_TREE_DELETE); checkLog(functionalCase.getId(), OperationLogType.DELETE, URL_MODULE_TREE_DELETE);

View File

@ -522,15 +522,15 @@
width: 200, width: 200,
showDrag: true, showDrag: true,
}, },
{ // {
title: 'caseManagement.featureCase.tableColumnExecutionResult', // title: 'caseManagement.featureCase.tableColumnExecutionResult',
dataIndex: 'lastExecuteResult', // dataIndex: 'lastExecuteResult',
slotName: 'lastExecuteResult', // slotName: 'lastExecuteResult',
titleSlotName: 'executeResultFilter', // titleSlotName: 'executeResultFilter',
showInTable: true, // showInTable: true,
width: 200, // width: 200,
showDrag: true, // showDrag: true,
}, // },
// { // {
// title: 'caseManagement.featureCase.tableColumnVersion', // title: 'caseManagement.featureCase.tableColumnVersion',
// slotName: 'versionName', // slotName: 'versionName',
@ -1094,6 +1094,7 @@
projectId: currentProjectId.value, projectId: currentProjectId.value,
selectIds: selectAll ? [] : selectedIds, selectIds: selectAll ? [] : selectedIds,
excludeIds: excludeIds || [], excludeIds: excludeIds || [],
moduleIds: props.activeFolder === 'all' ? [] : [props.activeFolder, ...props.offspringIds],
condition: { condition: {
keyword: keyword.value, keyword: keyword.value,
filter: propsRes.value.filter, filter: propsRes.value.filter,

View File

@ -381,24 +381,24 @@
width: 200, width: 200,
showDrag: true, showDrag: true,
}, },
{ // {
title: 'caseManagement.featureCase.tableColumnExecutionResult', // title: 'caseManagement.featureCase.tableColumnExecutionResult',
dataIndex: 'lastExecuteResult', // dataIndex: 'lastExecuteResult',
slotName: 'lastExecuteResult', // slotName: 'lastExecuteResult',
titleSlotName: 'executeResultFilter', // titleSlotName: 'executeResultFilter',
showInTable: true, // showInTable: true,
width: 200, // width: 200,
showDrag: true, // showDrag: true,
}, // },
{ // {
title: 'caseManagement.featureCase.tableColumnVersion', // title: 'caseManagement.featureCase.tableColumnVersion',
slotName: 'versionName', // slotName: 'versionName',
dataIndex: 'versionName', // dataIndex: 'versionName',
width: 300, // width: 300,
showTooltip: true, // showTooltip: true,
showInTable: true, // showInTable: true,
showDrag: true, // showDrag: true,
}, // },
{ {
title: 'caseManagement.featureCase.tableColumnModule', title: 'caseManagement.featureCase.tableColumnModule',
slotName: 'moduleId', slotName: 'moduleId',
@ -476,6 +476,7 @@
showInTable: true, showInTable: true,
sortable: { sortable: {
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
sorter: true,
}, },
width: 200, width: 200,
showDrag: true, showDrag: true,

View File

@ -240,8 +240,8 @@
setLoadListParams({ setLoadListParams({
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
sourceId: props.caseId, sourceId: props.caseId,
type: ['IMPORT', 'ADD', 'UPDATE'], types: ['IMPORT', 'ADD', 'UPDATE'],
module: ['CASE_MANAGEMENT_CASE_CREATE', 'CASE_MANAGEMENT_CASE_UPDATE'], modules: ['CASE_MANAGEMENT_CASE_CREATE', 'CASE_MANAGEMENT_CASE_UPDATE'],
}); });
await loadList(); await loadList();
featureCaseStore.getCaseCounts(props.caseId); featureCaseStore.getCaseCounts(props.caseId);