From 88cf46c8050fed968af74c90bfa729738a59b51d Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 2 Feb 2024 13:51:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E8=AF=84=E5=AE=A1=E5=8E=86=E5=8F=B2=E5=80=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/ExtCaseReviewHistoryMapper.java | 2 ++ .../mapper/ExtCaseReviewHistoryMapper.xml | 22 +++++++++++++++++++ .../service/ReviewFunctionalCaseService.java | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.java b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.java index 62c82f735c..271e3c6f8d 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.java @@ -12,6 +12,8 @@ public interface ExtCaseReviewHistoryMapper { List list(@Param("caseId") String caseId, @Param("reviewId") String reviewId); + List getHistoryListWidthAbandoned(@Param("caseId") String caseId, @Param("reviewId") String reviewId); + void updateDelete(@Param("caseIds") List caseIds, @Param("reviewId") String reviewId, @Param("delete") boolean delete); } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml index d40f644294..b814a3f4e5 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml @@ -25,6 +25,28 @@ and ch.abandoned = false + + update case_review_history set deleted = #{delete} diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java index c6cf09e422..05a2dfd37c 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java @@ -204,7 +204,7 @@ public class ReviewFunctionalCaseService { } public List getCaseReviewHistoryList(String reviewId, String caseId) { - List list = extCaseReviewHistoryMapper.list(caseId, reviewId); + List list = extCaseReviewHistoryMapper.getHistoryListWidthAbandoned(caseId, reviewId); for (CaseReviewHistoryDTO caseReviewHistoryDTO : list) { if (StringUtils.equalsIgnoreCase(caseReviewHistoryDTO.getCreateUser(), "system")) { caseReviewHistoryDTO.setUserName(Translator.get("case_review_history.system")); @@ -213,6 +213,6 @@ public class ReviewFunctionalCaseService { caseReviewHistoryDTO.setContentText(new String(caseReviewHistoryDTO.getContent(), StandardCharsets.UTF_8)); } } - return list; + return list.stream().sorted(Comparator.comparing(CaseReviewHistoryDTO::getCreateTime).reversed()).toList(); } }