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

@@ -90,5 +90,10 @@ public interface SubjectInfoDao {
@Param("pageSize") Integer pageSize);
List<SubjectInfo> getContributeCount();
Long querySubjectIdCursor(@Param("subjectId") Long subjectId,
@Param("categoryId") Long categoryId,
@Param("labelId") Long labelId,
@Param("cursor") int cursor);
}

View File

@@ -50,4 +50,7 @@ public interface SubjectInfoService {
List<SubjectInfo> queryPage(SubjectInfo subjectInfo, Long categoryId, Long labelId, int start, Integer pageSize);
List<SubjectInfo> getContributeCount();
Long querySubjectIdCursor(Long subjectId, Long categoryId, Long labelId, int cursor);
}

View File

@@ -81,4 +81,9 @@ public class SubjectInfoServiceImpl implements SubjectInfoService {
public List<SubjectInfo> getContributeCount() {
return this.subjectInfoDao.getContributeCount();
}
@Override
public Long querySubjectIdCursor(Long subjectId, Long categoryId, Long labelId, int cursor) {
return this.subjectInfoDao.querySubjectIdCursor(subjectId, categoryId, labelId, cursor);
}
}

View File

@@ -140,6 +140,23 @@
and a.subject_type = #{subjectInfo.subjectType}
</if>
</select>
<select id="querySubjectIdCursor" resultType="java.lang.Long">
select a.id
from subject_info a,
subject_mapping b
where a.id = b.subject_id
and b.category_id = #{categoryId}
and b.label_id = #{labelId}
<if test="cursor !=null and cursor == 1">
and a.id > #{subjectId}
</if>
<if test="cursor !=null and cursor == 0">
and a.id &lt; #{subjectId}
</if>
limit 0,1
</select>
<select id="queryPage" resultMap="SubjectInfoMap">
select a.id,
a.subject_name,