feat: 题目详情 上一题/下一题功能

This commit is contained in:
2024-03-08 16:47:13 +08:00
parent 9c93cf950d
commit 004fcf10bb
6 changed files with 45 additions and 0 deletions

View File

@@ -44,4 +44,5 @@ public interface SubjectInfoDomainService {
PageResult<SubjectInfoEs> getSubjectPageBySearch(SubjectInfoBO subjectInfoBO);
List<SubjectInfoBO> getContributeList();
}

View File

@@ -154,8 +154,22 @@ public class SubjectInfoDomainServiceImpl implements SubjectInfoDomainService {
bo.setLabelName(labelNameList);
bo.setLiked(subjectLikedDomainService.isLiked(subjectInfoBO.getId().toString(), LoginUtil.getLoginId()));
bo.setLikedCount(subjectLikedDomainService.getLikedCount(subjectInfoBO.getId().toString()));
assembleSubjectCursor(subjectInfoBO,bo);
return bo;
}
private void assembleSubjectCursor(SubjectInfoBO subjectInfoBO, SubjectInfoBO bo) {
Long categoryId = subjectInfoBO.getCategoryId();
Long labelId = subjectInfoBO.getLabelId();
Long subjectId = subjectInfoBO.getId();
if (Objects.isNull(categoryId) || Objects.isNull(labelId)) {
return;
}
Long nextSubjectId = subjectInfoService.querySubjectIdCursor(subjectId, categoryId, labelId, 1);
bo.setNextSubjectId(nextSubjectId);
Long lastSubjectId = subjectInfoService.querySubjectIdCursor(subjectId, categoryId, labelId, 0);
bo.setLastSubjectId(lastSubjectId);
}
@Override
public PageResult<SubjectInfoEs> getSubjectPageBySearch(SubjectInfoBO subjectInfoBO) {