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 89975b0..87e4805 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 @@ -27,4 +27,7 @@ public interface IChapterService extends IService{ // 删除章节 public void delete(String id); + // 科目章节 + public List findCourseChapter(String courseId); + } 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 53c6b76..47a8cec 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 @@ -11,9 +11,13 @@ import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.Condition; +import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.tamguo.common.utils.SystemConstant; +import com.tamguo.modules.tiku.dao.BookMapper; import com.tamguo.modules.tiku.dao.ChapterMapper; +import com.tamguo.modules.tiku.dao.CourseMapper; +import com.tamguo.modules.tiku.model.BookEntity; import com.tamguo.modules.tiku.model.ChapterEntity; import com.tamguo.modules.tiku.model.condition.ChapterCondition; import com.tamguo.modules.tiku.model.enums.ChapterStatusEnum; @@ -24,6 +28,10 @@ public class ChapterServiceImpl extends ServiceImpl findCourseChapter(String courseId) { + List bookList = bookMapper.selectList(Condition.create().eq("course_id", courseId)); + if(bookList.size() == 0) { + return null; + } + Condition condition = Condition.create(); + condition.eq("tree_level", 1); + condition.eq("book_id", bookList.get(0).getId()); + List list = chapterMapper.selectPage(new Page<>(1, 5), condition); + return list; + } } diff --git a/tamguo-tms/src/main/java/com/tamguo/web/tiku/CourseController.java b/tamguo-tms/src/main/java/com/tamguo/web/tiku/CourseController.java index ad9d142..08bf7e5 100644 --- a/tamguo-tms/src/main/java/com/tamguo/web/tiku/CourseController.java +++ b/tamguo-tms/src/main/java/com/tamguo/web/tiku/CourseController.java @@ -6,6 +6,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.baomidou.mybatisplus.mapper.Condition; import com.tamguo.modules.tiku.model.BookEntity; @@ -65,4 +66,10 @@ public class CourseController { } } + @RequestMapping(value = {"course/findChapter.html"}, method = RequestMethod.GET) + @ResponseBody + public List findChapterByCourseId(String courseId){ + return iChapterService.findCourseChapter(courseId); + } + } diff --git a/tamguo-tms/src/main/resources/templates/book.html b/tamguo-tms/src/main/resources/templates/book.html index e872ee0..709093e 100644 --- a/tamguo-tms/src/main/resources/templates/book.html +++ b/tamguo-tms/src/main/resources/templates/book.html @@ -3,8 +3,8 @@ 探果题库_聪明的学生都在这里 - - + + diff --git a/tamguo-tms/src/main/resources/templates/chapter.html b/tamguo-tms/src/main/resources/templates/chapter.html index ef7b34a..7a78f8d 100644 --- a/tamguo-tms/src/main/resources/templates/chapter.html +++ b/tamguo-tms/src/main/resources/templates/chapter.html @@ -3,8 +3,8 @@ 探果题库_聪明的学生都在这里 - - + + diff --git a/tamguo-tms/src/main/resources/templates/index.html b/tamguo-tms/src/main/resources/templates/index.html index 6f52a46..6b719d1 100644 --- a/tamguo-tms/src/main/resources/templates/index.html +++ b/tamguo-tms/src/main/resources/templates/index.html @@ -4,8 +4,8 @@ 探果题库_聪明的学生都在这里 - - + + diff --git a/tamguo-tms/src/main/resources/templates/login.html b/tamguo-tms/src/main/resources/templates/login.html index 629608f..e4a3079 100644 --- a/tamguo-tms/src/main/resources/templates/login.html +++ b/tamguo-tms/src/main/resources/templates/login.html @@ -3,8 +3,8 @@ 登录_探果网 - - + + diff --git a/tamguo-tms/src/main/resources/templates/paper.html b/tamguo-tms/src/main/resources/templates/paper.html index ce43b3a..3521744 100644 --- a/tamguo-tms/src/main/resources/templates/paper.html +++ b/tamguo-tms/src/main/resources/templates/paper.html @@ -3,8 +3,8 @@ 探果题库_聪明的学生都在这里 - - + + diff --git a/tamguo-tms/src/main/resources/templates/paperlist.html b/tamguo-tms/src/main/resources/templates/paperlist.html index 5017982..e4555d6 100644 --- a/tamguo-tms/src/main/resources/templates/paperlist.html +++ b/tamguo-tms/src/main/resources/templates/paperlist.html @@ -3,8 +3,8 @@ 探果题库_聪明的学生都在这里 - - + + diff --git a/tamguo-tms/src/main/resources/templates/question.html b/tamguo-tms/src/main/resources/templates/question.html index ccdd8df..fef7a8f 100644 --- a/tamguo-tms/src/main/resources/templates/question.html +++ b/tamguo-tms/src/main/resources/templates/question.html @@ -3,8 +3,8 @@ 探果题库_聪明的学生都在这里 - - + + diff --git a/tamguo-tms/src/main/resources/templates/questionList.html b/tamguo-tms/src/main/resources/templates/questionList.html index 8ad4d1b..a04fee1 100644 --- a/tamguo-tms/src/main/resources/templates/questionList.html +++ b/tamguo-tms/src/main/resources/templates/questionList.html @@ -3,8 +3,8 @@ 探果题库_聪明的学生都在这里 - - + + diff --git a/tamguo-tms/src/main/resources/templates/register.html b/tamguo-tms/src/main/resources/templates/register.html index 59ac067..e9c59e6 100644 --- a/tamguo-tms/src/main/resources/templates/register.html +++ b/tamguo-tms/src/main/resources/templates/register.html @@ -3,8 +3,8 @@ 注册_探果网 - - + + diff --git a/tamguo-tms/src/main/resources/templates/subject.html b/tamguo-tms/src/main/resources/templates/subject.html index 5e9376c..9057edf 100644 --- a/tamguo-tms/src/main/resources/templates/subject.html +++ b/tamguo-tms/src/main/resources/templates/subject.html @@ -3,8 +3,8 @@ 探果题库_聪明的学生都在这里 - - + +