From 07eedc9144a72ec96800237b946f2c556aeb33fa Mon Sep 17 00:00:00 2001 From: tamguo Date: Sat, 25 Aug 2018 16:23:40 +0800 Subject: [PATCH] fix bug --- .../java/com/tamguo/modules/tiku/dao/ChapterMapper.java | 6 ++++++ .../com/tamguo/modules/tiku/service/IChapterService.java | 3 +++ .../modules/tiku/service/impl/ChapterServiceImpl.java | 6 ++++++ .../main/java/com/tamguo/web/tiku/QuestionContrller.java | 2 +- tamguo-tms/src/main/resources/templates/questionList.html | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/dao/ChapterMapper.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/dao/ChapterMapper.java index a8b97fb..aa67b54 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/dao/ChapterMapper.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/dao/ChapterMapper.java @@ -1,8 +1,14 @@ 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.modules.tiku.model.ChapterEntity; public interface ChapterMapper extends SuperMapper{ + @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); + } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IChapterService.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IChapterService.java index 87e4805..e7b5256 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IChapterService.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/IChapterService.java @@ -30,4 +30,7 @@ public interface IChapterService extends IService{ // 科目章节 public List findCourseChapter(String courseId); + // 获取下一章节 + public ChapterEntity selectNextChapter(String parentCode , String id); + } diff --git a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/ChapterServiceImpl.java b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/ChapterServiceImpl.java index 47a8cec..23b0486 100644 --- a/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/ChapterServiceImpl.java +++ b/tamguo-modules-core/src/main/java/com/tamguo/modules/tiku/service/impl/ChapterServiceImpl.java @@ -211,4 +211,10 @@ public class ChapterServiceImpl extends ServiceImpl list = chapterMapper.selectPage(new Page<>(1, 5), condition); return list; } + + @Transactional(readOnly=true) + @Override + public ChapterEntity selectNextChapter(String parentCode , String id) { + return chapterMapper.selectNextChapter(parentCode , id); + } } diff --git a/tamguo-tms/src/main/java/com/tamguo/web/tiku/QuestionContrller.java b/tamguo-tms/src/main/java/com/tamguo/web/tiku/QuestionContrller.java index a0dcbd5..3ae1c4b 100644 --- a/tamguo-tms/src/main/java/com/tamguo/web/tiku/QuestionContrller.java +++ b/tamguo-tms/src/main/java/com/tamguo/web/tiku/QuestionContrller.java @@ -55,7 +55,7 @@ public class QuestionContrller { CourseEntity course = iCourseService.selectById(chapter.getCourseId()); SubjectEntity subject = iSubjectService.selectById(course.getSubjectId()); ChapterEntity parentChapter = iChapterService.selectById(chapter.getParentCode()); - ChapterEntity nextChapter = iChapterService.selectById(chapter.getId()); + ChapterEntity nextChapter = iChapterService.selectNextChapter(chapter.getParentCode() , chapter.getId()); Page page = new Page<>(); page.setCurrent(current); diff --git a/tamguo-tms/src/main/resources/templates/questionList.html b/tamguo-tms/src/main/resources/templates/questionList.html index d1dacc5..d7993fb 100644 --- a/tamguo-tms/src/main/resources/templates/questionList.html +++ b/tamguo-tms/src/main/resources/templates/questionList.html @@ -59,7 +59,7 @@