refactor(用例管理): 评审历史倒序

This commit is contained in:
guoyuqi 2024-02-02 13:51:55 +08:00 committed by 刘瑞斌
parent 3cbf941b1a
commit 88cf46c805
3 changed files with 26 additions and 2 deletions

View File

@ -12,6 +12,8 @@ public interface ExtCaseReviewHistoryMapper {
List<CaseReviewHistoryDTO> list(@Param("caseId") String caseId, @Param("reviewId") String reviewId);
List<CaseReviewHistoryDTO> getHistoryListWidthAbandoned(@Param("caseId") String caseId, @Param("reviewId") String reviewId);
void updateDelete(@Param("caseIds") List<String> caseIds, @Param("reviewId") String reviewId, @Param("delete") boolean delete);
}

View File

@ -25,6 +25,28 @@
and ch.abandoned = false
</select>
<select id="getHistoryListWidthAbandoned" resultType="io.metersphere.functional.dto.CaseReviewHistoryDTO">
SELECT
ch.id,
ch.review_id,
ch.case_id,
ch.status,
ch.notifier,
ch.create_user,
ch.create_time,
ch.content,
u.name as userName,
ux.avatar as userLogo
FROM
case_review_history ch
left join user u on ch.create_user = u.id
left join user_extend ux on ch.create_user = ux.id
where ch.case_id = #{caseId}
<if test="reviewId != null and reviewId != ''">
and ch.review_id = #{reviewId}
</if>
</select>
<update id="updateDelete">
update case_review_history
set deleted = #{delete}

View File

@ -204,7 +204,7 @@ public class ReviewFunctionalCaseService {
}
public List<CaseReviewHistoryDTO> getCaseReviewHistoryList(String reviewId, String caseId) {
List<CaseReviewHistoryDTO> list = extCaseReviewHistoryMapper.list(caseId, reviewId);
List<CaseReviewHistoryDTO> 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();
}
}