refactor(用例管理): 关联附件被删除,详情显示删除附件名称&首页默认图片替换

This commit is contained in:
WangXu10 2024-02-03 14:01:44 +08:00 committed by Craftsman
parent dc1a869105
commit 0e5a05d499
6 changed files with 19 additions and 3 deletions

View File

@ -38,4 +38,7 @@ public class FunctionalCaseAttachmentDTO implements Serializable {
@Schema(description = "创建时间") @Schema(description = "创建时间")
private Long createTime; private Long createTime;
@Schema(description = "是否删除")
private boolean deleted;
} }

View File

@ -146,6 +146,9 @@ public class FunctionalCaseAttachmentService {
BeanUtils.copyBean(attachmentDTO, fileInfo); BeanUtils.copyBean(attachmentDTO, fileInfo);
attachmentDTO.setId(fileInfo.getFileId()); attachmentDTO.setId(fileInfo.getFileId());
attachmentDTO.setAssociationId(fileInfo.getId()); attachmentDTO.setAssociationId(fileInfo.getId());
if (StringUtils.isNotBlank(fileInfo.getDeletedFileName())) {
attachmentDTO.setFileName(fileInfo.getDeletedFileName());
}
return attachmentDTO; return attachmentDTO;
})); }));
attachmentDTOs.addAll(filesDTOs); attachmentDTOs.addAll(filesDTOs);

View File

@ -1,7 +1,9 @@
INSERT INTO file_metadata(id, name, type, size, create_time, update_time, project_id, storage, create_user, update_user, tags, description, module_id, path, latest, ref_id, file_version) VALUES ('relate_file_meta_id_1', 'formItem', 'ts', 2502, 1698058347559, 1698058347559, '100001100001', 'MINIO', 'admin', 'admin', NULL, NULL, 'root', '100001100001/1127016598347779', b'1', '1127016598347779', '1127016598347779'); INSERT INTO file_metadata(id, name, type, size, create_time, update_time, project_id, storage, create_user, update_user, tags, description, module_id, path, latest, ref_id, file_version) VALUES ('relate_file_meta_id_1', 'formItem', 'ts', 2502, 1698058347559, 1698058347559, '100001100001', 'MINIO', 'admin', 'admin', NULL, NULL, 'root', '100001100001/1127016598347779', b'1', '1127016598347779', '1127016598347779');
INSERT INTO file_metadata(id, name, type, size, create_time, update_time, project_id, storage, create_user, update_user, tags, description, module_id, path, latest, ref_id, file_version) VALUES ('relate_file_meta_id_2', 'formItem', 'ts', 2502, 1698058347559, 1698058347559, '100001100001', 'MINIO', 'admin', 'admin', NULL, NULL, 'root', '100001100001/1127016598347779', b'1', '1127016598347779', '1127016598347779'); INSERT INTO file_metadata(id, name, type, size, create_time, update_time, project_id, storage, create_user, update_user, tags, description, module_id, path, latest, ref_id, file_version) VALUES ('relate_file_meta_id_2', 'formItem', 'ts', 2502, 1698058347559, 1698058347559, '100001100001', 'MINIO', 'admin', 'admin', NULL, NULL, 'root', '100001100001/1127016598347779', b'1', '1127016598347779', '1127016598347779');
INSERT INTO file_association(id, source_type, source_id, file_id, file_ref_id, file_version, create_time, update_user, update_time, create_user) VALUES ('file_association_1', 'FUNCTIONAL_CASE', 'TEST_FUNCTIONAL_CASE_ID', 'relate_file_meta_id_1', '1', '1', 1698983271536, 'admin', 1698983271536, 'admin'); INSERT INTO file_association(id, source_type, source_id, file_id, file_ref_id, file_version, create_time, update_user, update_time, create_user, deleted, deleted_file_name)
VALUES ('file_association_1', 'FUNCTIONAL_CASE', 'TEST_FUNCTIONAL_CASE_ID', 'relate_file_meta_id_1', '1', '1', 1698983271536, 'admin', 1698983271536, 'admin', b'0', NULL),
('file_association_2', 'FUNCTIONAL_CASE', 'TEST_FUNCTIONAL_CASE_ID_2', 'relate_file_meta_id_2', '1', '1', 1698983271536, 'admin', 1698983271536, 'admin', b'1', '测试删除');
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time) INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)

View File

@ -47,4 +47,10 @@ public class FileInfo implements Serializable {
@Schema(description = "文件资源ID") @Schema(description = "文件资源ID")
private String metadataId; private String metadataId;
@Schema(description = "是否删除")
private boolean deleted;
@Schema(description = "删除时的文件名称")
private String deletedFileName;
} }

View File

@ -27,7 +27,9 @@
file_metadata.id as metadataId, file_metadata.id as metadataId,
'false' AS local, 'false' AS local,
file_association.create_user AS createUser, file_association.create_user AS createUser,
file_association.create_time AS createTime file_association.create_time AS createTime,
file_association.deleted deleted,
file_association.deleted_file_name AS deletedFileName
FROM FROM
file_association file_association
LEFT JOIN file_metadata ON file_association.file_id = file_metadata.id LEFT JOIN file_metadata ON file_association.file_id = file_metadata.id

View File

@ -51,7 +51,7 @@ public class BaseDisplayService {
case "icon" -> case "icon" ->
bytes = IOUtils.toByteArray(resolver.getResource("/static/favicon.ico").getInputStream()); bytes = IOUtils.toByteArray(resolver.getResource("/static/favicon.ico").getInputStream());
case "logoPlatform" -> { case "logoPlatform" -> {
bytes = IOUtils.toByteArray(resolver.getResource("/static/images/MS-full-logo.svg").getInputStream()); bytes = IOUtils.toByteArray(resolver.getResource("/static/images/MeterSphere-logo.svg").getInputStream());
contentType = MediaType.valueOf("image/svg+xml"); contentType = MediaType.valueOf("image/svg+xml");
} }
case "loginImage" -> case "loginImage" ->