diff --git a/tamguo-tms/src/main/java/com/tamguo/web/tiku/BookController.java b/tamguo-tms/src/main/java/com/tamguo/web/tiku/BookController.java new file mode 100644 index 0000000..3fec548 --- /dev/null +++ b/tamguo-tms/src/main/java/com/tamguo/web/tiku/BookController.java @@ -0,0 +1,57 @@ +package com.tamguo.web.tiku; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +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.servlet.ModelAndView; + +import com.baomidou.mybatisplus.mapper.Condition; +import com.tamguo.modules.tiku.model.BookEntity; +import com.tamguo.modules.tiku.model.ChapterEntity; +import com.tamguo.modules.tiku.model.CourseEntity; +import com.tamguo.modules.tiku.model.SubjectEntity; +import com.tamguo.modules.tiku.service.IBookService; +import com.tamguo.modules.tiku.service.IChapterService; +import com.tamguo.modules.tiku.service.ICourseService; +import com.tamguo.modules.tiku.service.ISubjectService; + +@Controller +public class BookController { + + @Autowired + IBookService iBookService; + @Autowired + IChapterService iChapterService; + @Autowired + ISubjectService iSubjectService; + @Autowired + ICourseService iCourseService; + + @SuppressWarnings("unchecked") + @RequestMapping(value = {"book/{uid}.html"}, method = RequestMethod.GET) + public ModelAndView index(@PathVariable String uid , ModelAndView model) { + try { + BookEntity book = iBookService.selectById(uid); + SubjectEntity subject = iSubjectService.selectById(book.getSubjectId()); + List courseList = iCourseService.selectList(Condition.create().eq("subject_id", subject.getId())); + List bookList = iBookService.selectList(Condition.create().eq("course_id", book.getCourseId())); + CourseEntity course = iCourseService.selectById(book.getCourseId()); + List chapterList = iChapterService.selectList(Condition.create().eq("book_id", uid)); + model.addObject("book", book); + model.addObject("subject", subject); + model.addObject("course", course); + model.addObject("chapterList" , chapterList); + model.addObject("courseList", courseList); + model.addObject("bookList", bookList); + model.setViewName("book"); + return model; + } catch (Exception e) { + model.setViewName("404"); + return model; + } + } + +} diff --git a/tamguo-tms/src/main/resources/templates/book.html b/tamguo-tms/src/main/resources/templates/book.html index adf7f33..e872ee0 100644 --- a/tamguo-tms/src/main/resources/templates/book.html +++ b/tamguo-tms/src/main/resources/templates/book.html @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -28,23 +28,23 @@ @@ -75,7 +75,7 @@
-
+

第一章 集合与常用逻辑用语

@@ -87,11 +87,11 @@
-
+

第一章 集合与常用逻辑用语

- 随机来 + 随机来 15 @@ -108,7 +108,7 @@

1 集合的概念及运算

1181 试题 -
随机来 + 随机来 10 @@ -124,7 +124,7 @@

@@ -143,8 +143,8 @@
- 探果题库 - 高考 + 探果题库 + 高考 理科数学
@@ -156,9 +156,9 @@
- - - - - + + + + + \ No newline at end of file