main
tamguo 7 years ago
parent 33d18b954a
commit 07eedc9144

@ -1,8 +1,14 @@
package com.tamguo.modules.tiku.dao; package com.tamguo.modules.tiku.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.tamguo.config.dao.SuperMapper; import com.tamguo.config.dao.SuperMapper;
import com.tamguo.modules.tiku.model.ChapterEntity; import com.tamguo.modules.tiku.model.ChapterEntity;
public interface ChapterMapper extends SuperMapper<ChapterEntity>{ public interface ChapterMapper extends SuperMapper<ChapterEntity>{
@Select("select * from tiku_chapter where parent_code = #{parentCode} and id = (select min(id) from tiku_chapter where id > #{id})")
ChapterEntity selectNextChapter(@Param(value="parentCode")String parentCode , @Param(value="id")String id);
} }

@ -30,4 +30,7 @@ public interface IChapterService extends IService<ChapterEntity>{
// 科目章节 // 科目章节
public List<ChapterEntity> findCourseChapter(String courseId); public List<ChapterEntity> findCourseChapter(String courseId);
// 获取下一章节
public ChapterEntity selectNextChapter(String parentCode , String id);
} }

@ -211,4 +211,10 @@ public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, ChapterEntity
List<ChapterEntity> list = chapterMapper.selectPage(new Page<>(1, 5), condition); List<ChapterEntity> list = chapterMapper.selectPage(new Page<>(1, 5), condition);
return list; return list;
} }
@Transactional(readOnly=true)
@Override
public ChapterEntity selectNextChapter(String parentCode , String id) {
return chapterMapper.selectNextChapter(parentCode , id);
}
} }

@ -55,7 +55,7 @@ public class QuestionContrller {
CourseEntity course = iCourseService.selectById(chapter.getCourseId()); CourseEntity course = iCourseService.selectById(chapter.getCourseId());
SubjectEntity subject = iSubjectService.selectById(course.getSubjectId()); SubjectEntity subject = iSubjectService.selectById(course.getSubjectId());
ChapterEntity parentChapter = iChapterService.selectById(chapter.getParentCode()); ChapterEntity parentChapter = iChapterService.selectById(chapter.getParentCode());
ChapterEntity nextChapter = iChapterService.selectById(chapter.getId()); ChapterEntity nextChapter = iChapterService.selectNextChapter(chapter.getParentCode() , chapter.getId());
Page<QuestionEntity> page = new Page<>(); Page<QuestionEntity> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);

@ -59,7 +59,7 @@
<div class="nexttolearn"> <div class="nexttolearn">
<div class="next-inner clearfix"> <div class="next-inner clearfix">
<a th:if="${questionList.pages - questionList.current} > 0" th:href="${domainName + 'questionlist/' +chapter.id + '-'+(questionList.current+1)+'-'+questionList.size+'.html'}" class="tolearn">继续学习</a> <a th:if="${questionList.pages - questionList.current} > 0" th:href="${domainName + 'questionlist/' +chapter.id + '-'+(questionList.current+1)+'-'+questionList.size+'.html'}" class="tolearn">继续学习</a>
<a th:if="${questionList.pages - questionList.current} == 0" th:href="${domainName + 'course/' + courseId +'.html'}" class="tolearn">已学完, 返回章节学习</a> <a th:if="${questionList.pages - questionList.current} <= 0" th:href="${domainName + 'course/' + courseId +'.html'}" class="tolearn">已学完, 返回章节学习</a>
<a th:if="${nextChapter == null}" class="next-done">棒棒哒,已是最后一个知识点</a> <a th:if="${nextChapter == null}" class="next-done">棒棒哒,已是最后一个知识点</a>
<a th:if="${nextChapter != null}" th:href="${domainName + 'questionlist/'+nextChapter.id+'-1-5.html'}" class="nextpoint">学习下一知识点</a> <a th:if="${nextChapter != null}" th:href="${domainName + 'questionlist/'+nextChapter.id+'-1-5.html'}" class="nextpoint">学习下一知识点</a>
</div> </div>

Loading…
Cancel
Save