main
tamguo 7 years ago
parent 6cd4075d2c
commit 200565c2dc

@ -0,0 +1,8 @@
package com.tamguo.dao;
import com.tamguo.config.dao.SuperMapper;
import com.tamguo.model.BookEntity;
public interface BookMapper extends SuperMapper<BookEntity>{
}

@ -8,7 +8,7 @@ import com.tamguo.model.ChapterEntity;
public interface ChapterMapper extends SuperMapper<ChapterEntity>{
List<ChapterEntity> findByCourseId(@Param(value="courseId") String courseId);
List<ChapterEntity> findByBookId(@Param(value="bookId") String bookId);
List<ChapterEntity> findByParentId(@Param(value="parentId") String parentId);

@ -0,0 +1,96 @@
package com.tamguo.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
@TableName(value="tiku_book")
public class BookEntity extends Model<BookEntity>{
private static final long serialVersionUID = 1L;
@TableId
private String uid;
private String subjectId;
private String courseId;
private String name;
private String publishingHouse;
private String questionNum;
private String pointNum;
private Integer orders;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getSubjectId() {
return subjectId;
}
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
public String getCourseId() {
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPublishingHouse() {
return publishingHouse;
}
public void setPublishingHouse(String publishingHouse) {
this.publishingHouse = publishingHouse;
}
public String getQuestionNum() {
return questionNum;
}
public void setQuestionNum(String questionNum) {
this.questionNum = questionNum;
}
public String getPointNum() {
return pointNum;
}
public void setPointNum(String pointNum) {
this.pointNum = pointNum;
}
public Integer getOrders() {
return orders;
}
public void setOrders(Integer orders) {
this.orders = orders;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
protected Serializable pkVal() {
return getUid();
}
}

@ -0,0 +1,8 @@
package com.tamguo.service;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.model.BookEntity;
public interface IBookService extends IService<BookEntity>{
}

@ -1,9 +1,11 @@
package com.tamguo.service;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.model.ChapterEntity;
public interface IChapterService {
public interface IChapterService extends IService<ChapterEntity>{
// 获取科目章节
public List<ChapterEntity> findCourseChapter(String courseId);

@ -1,9 +1,11 @@
package com.tamguo.service;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.model.CourseEntity;
public interface ICourseService {
public interface ICourseService extends IService<CourseEntity>{
/** 根据考试获取科目 */
List<CourseEntity> findBySubjectId(String subjectId);

@ -1,9 +1,10 @@
package com.tamguo.service;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.model.SubjectEntity;
public interface ISubjectService {
public interface ISubjectService extends IService<SubjectEntity>{
public SubjectEntity find(String uid);

@ -0,0 +1,13 @@
package com.tamguo.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.dao.BookMapper;
import com.tamguo.model.BookEntity;
import com.tamguo.service.IBookService;
@Service
public class BookService extends ServiceImpl<BookMapper, BookEntity> implements IBookService {
}

@ -10,20 +10,21 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.dao.ChapterMapper;
import com.tamguo.model.ChapterEntity;
import com.tamguo.service.IChapterService;
import com.tamguo.util.TamguoConstant;
@Service
public class ChapterService implements IChapterService{
public class ChapterService extends ServiceImpl<ChapterMapper, ChapterEntity> implements IChapterService{
@Autowired
private ChapterMapper chapterMapper;
@Override
public List<ChapterEntity> findCourseChapter(String courseId) {
List<ChapterEntity> chapterList = chapterMapper.findByCourseId(courseId);
public List<ChapterEntity> findCourseChapter(String bookId) {
List<ChapterEntity> chapterList = chapterMapper.findByBookId(bookId);
// 获取根chapter UID
String rootUid = StringUtils.EMPTY;
@ -85,7 +86,7 @@ public class ChapterService implements IChapterService{
if(StringUtils.isEmpty(courseId) || "null".equals(courseId)){
return rootChapterNode();
}
List<ChapterEntity> list = chapterMapper.findByCourseId(courseId);
List<ChapterEntity> list = chapterMapper.findByBookId(courseId);
if(CollectionUtils.isEmpty(list)) {
return rootChapterNode();
}

@ -0,0 +1,58 @@
package com.tamguo.web;
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.model.BookEntity;
import com.tamguo.model.ChapterEntity;
import com.tamguo.model.CourseEntity;
import com.tamguo.model.SubjectEntity;
import com.tamguo.service.IBookService;
import com.tamguo.service.IChapterService;
import com.tamguo.service.ICourseService;
import com.tamguo.service.ISubjectService;
@Controller
public class BookController {
@Autowired
IBookService iBookService;
@Autowired
IChapterService iChapterService;
@Autowired
ISubjectService iSubjectService;
@Autowired
ICourseService iCourseService;
@SuppressWarnings("unchecked")
@RequestMapping(value = {"book/{uid}"}, method = RequestMethod.GET)
public ModelAndView index(@PathVariable String uid , ModelAndView model) {
try {
BookEntity book = iBookService.selectById(uid);
SubjectEntity subject = iSubjectService.find(book.getSubjectId());
List<CourseEntity> courseList = subject.getCourseList();
List<BookEntity> bookList = iBookService.selectList(Condition.create().eq("course_id", book.getCourseId()));
CourseEntity course = iCourseService.selectById(book.getCourseId());
List<ChapterEntity> 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;
}
}
}

@ -16,9 +16,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
*/
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.mapper.Condition;
import com.tamguo.model.BookEntity;
import com.tamguo.model.ChapterEntity;
import com.tamguo.model.CourseEntity;
import com.tamguo.model.SubjectEntity;
import com.tamguo.service.IBookService;
import com.tamguo.service.IChapterService;
import com.tamguo.service.ICourseService;
import com.tamguo.service.ISubjectService;
@ -33,19 +36,26 @@ public class CourseController {
ICourseService iCourseService;
@Autowired
ISubjectService iSubjectService;
@Autowired
IBookService iBookService;
@SuppressWarnings("unchecked")
@RequestMapping(value = {"course/{uid}"}, method = RequestMethod.GET)
public ModelAndView index(@PathVariable String uid , ModelAndView model) {
try {
CourseEntity course = iCourseService.find(uid);
List<BookEntity> bookList = iBookService.selectList(Condition.create().eq("course_id", uid));
BookEntity book = bookList.get(0);
SubjectEntity subject = iSubjectService.find(course.getSubjectId());
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(uid);
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(book.getUid());
List<CourseEntity> courseList = iCourseService.findBySubjectId(course.getSubjectId());
model.addObject("chapterList", chapterList);
model.addObject("courseList", courseList);
model.addObject("course", course);
model.addObject("subject", subject);
model.addObject("bookList", bookList);
model.addObject("book" , book);
model.setViewName("chapter");
return model;

@ -13,10 +13,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.mapper.Condition;
import com.tamguo.model.BookEntity;
import com.tamguo.model.ChapterEntity;
import com.tamguo.model.CourseEntity;
import com.tamguo.model.SubjectEntity;
import com.tamguo.service.IAreaService;
import com.tamguo.service.IBookService;
import com.tamguo.service.IChapterService;
import com.tamguo.service.ISubjectService;
import com.tamguo.util.Result;
@ -38,14 +41,21 @@ public class SubjectController {
private IAreaService iAreaService;
@Autowired
private ISubjectService iSubjectService;
@Autowired
private IBookService iBookService;
@SuppressWarnings("unchecked")
@RequestMapping(value = {"subject/{subjectId}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String subjectId , ModelAndView model) {
try {
SubjectEntity subject = iSubjectService.find(subjectId);
// 获取第一个科目
CourseEntity course = subject.getCourseList().get(0);
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(course.getUid());
// 获取第一本书
List<BookEntity> bookList = iBookService.selectList(Condition.create().eq("course_id", course.getUid()));
BookEntity book = bookList.get(0);
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(book.getUid());
model.setViewName("subject");
model.addObject("subject", subject);
model.addObject("course" , course);

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tamguo.dao.BookMapper">
</mapper>

@ -2,12 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tamguo.dao.ChapterMapper">
<select id="findByCourseId" resultType="ChapterEntity">
<select id="findByBookId" resultType="ChapterEntity">
SELECT
c.uid,c.course_id , c.parent_id , c.`name` , c.question_num , c.point_num , c.orders
FROM
tiku_chapter c
WHERE c.course_id = #{courseId}
WHERE c.book_id = #{bookId}
ORDER BY c.uid asc
</select>

@ -0,0 +1,164 @@
<!DOCTYPE html>
<html lang="Zh-hans" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>探果题库_聪明的学生都在这里</title>
<meta name="description" content="探果题库携手高校名师为考生提供高效的智能备考服务,涵括领域有高考、财会类、建筑工程、职业资格、医卫类、计算机类和学历类等热门考试题库。拥有高校名师丰富的经验,优质的学习资料和备考全阶段的高效服务,助您丰富自我,不断前行!"/>
<meta name="keyword" content="探果题库,数学试卷,高校试题,名校,名校试题,名校试卷,高校名师,名师专访,名师教案,名师课堂试题库,试卷库,智能题库,历年真题,模拟试题,押题,预测试题,高考,会计证,会计从业,会计师,经济师,施工员,建造师,建筑师,造价师,职业资格,证券资格,考研,计算机考试,建筑考试,财会类,医卫类,护士资格,公务员,知识点,试题,试卷"/>
<meta name="author" content="Tamguo Team" />
<meta name="copyright" content="Tamguo" />
<meta name="author" content="Tamguo Team" />
<meta name="copyright" content="Tamguo" />
<link rel="stylesheet" th:href="${setting.domain + 'css/main.css'}"></link>
<link rel="stylesheet" th:href="${setting.domain + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/iconfont.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/chapter.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/footer.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/minilogin.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${setting.domain + 'images/favicon.png'}" />
</head>
<body>
<!-- 头部-->
<div th:replace="include/header :: header"></div>
<!--主体-->
<div class="content-wp">
<div class="main">
<!--二级菜单开始-->
<div class="main-submenu">
<div class="submenu-contain clearfix">
<span class="contain-title">
<a th:href="${setting.domain + 'subject/' + subjectId + '.html'}" th:text="${subject.name}">高考</a>
</span>
<ul class="contain-ul">
<li class="contain-li">
<a th:href="${setting.domain + 'subject/' + subject.uid + '.html'}" class="">考试首页</a>
</li>
<li class="contain-li curr">
<a class="curr " th:href="${setting.domain + 'course/'+course.uid+'.html'}">章节学习</a>
</li>
<li class="contain-li">
<a class="" th:href="${setting.domain + 'paperlist/' + subject.uid + '-'+course.uid+'-'+setting.PAPER_TYPE_ZHENTI+'-0-0-1.html'}">真题试卷</a>
</li>
<li class="contain-li">
<a class="" th:href="${setting.domain + 'paperlist/' + subject.uid + '-'+course.uid+'-'+setting.PAPER_TYPE_MONI+'-0-0-1.html'}">模拟试卷</a>
</li>
<li class="contain-li">
<a class="" th:href="${setting.domain + 'paperlist/' + subject.uid + '-'+course.uid+'-'+setting.PAPER_TYPE_YATI+'-0-0-1.html'}">考前押题</a>
</li>
</ul>
</div>
</div>
<!--二级菜单结束-->
<!--章节内容开始-->
<div class="main-inner clearfix">
<a class="backtotop iconfont icon-xiangshang" href="#" style="display: none;"></a>
<div class="screening clearfix">
<ul class="sc-subject clearfix">
<li>科目:</li>
<li th:class="${c.uid == course.uid} ? 'selected' : ''" th:each="c,cStat:${courseList}">
<a th:href="${setting.domain + 'course/'+c.uid+'.html'}" th:text="${c.name}">
理科数学
</a>
</li>
</ul>
<ul class="sc-subject clearfix">
<li>课本:</li>
<li th:class="${book.uid == b.uid} ? selected : ''" th:each="b,index:${bookList}"><a th:href="${setting.domain + 'book/' + b.uid + '.html'}" th:text="${b.name}">必修1</a></li>
</ul>
</div>
<div class="list-left">
<div id="outline" tabindex="0" style="overflow: hidden; position: static; outline: none; height: 697px; top: 0px;">
<div class="outline-content" style="transform: translate3d(0px, 0px, 0px);">
<div th:class="${cStat.index==0} ? 'out-chapter show' : 'out-chapter'" th:attr="data-chapterId=${c.uid}" th:each="c,cStat:${chapterList}">
<h3 class="k1" data-class="dct-0" title="第一章 集合与常用逻辑用语">
<i class="iconfont icon-unie047 icon-zhankai"></i> <span th:text="${c.name}">第一章 集合与常用逻辑用语</span>
</h3>
</div>
<div class="blank" style="height: 70px;"></div>
</div>
<div id="ascrail2000" class="nicescroll-rails nicescroll-rails-vr" style="width: 15px; z-index: auto; cursor: default; position: absolute; top: 0px; right: 0px; touch-action: none; height: 697px; opacity: 0; display: block;"><div class="nicescroll-cursors" style="position: relative; top: 0px; float: right; width: 5px; height: 403px; background-color: rgb(219, 219, 219); border: 5px; background-clip: padding-box; border-radius: 5px; touch-action: none;"></div></div><div id="ascrail2000-hr" class="nicescroll-rails nicescroll-rails-hr" style="height: 15px; z-index: auto; position: absolute; left: 0px; bottom: 0px; cursor: default; display: none; width: 329px; opacity: 0;"><div class="nicescroll-cursors" style="position: absolute; top: 0px; height: 5px; width: 329px; background-color: rgb(219, 219, 219); border: 5px; background-clip: padding-box; border-radius: 5px;"></div></div></div>
</div>
<div class="list-right">
<div class="detail">
<div class="detail-chapter" th:attr="data-chapterId=${c.uid}" th:each="c,cStat:${chapterList}" th:style="${cStat.index==0}? 'display:block;' : 'display: none;'">
<div class="detail-chapter-title dct-0" id="dct-0">
<h3 th:text="${c.name}">第一章 集合与常用逻辑用语</h3>
<a target="_blank" class="fifteen" th:href="${setting.domain + 'questionlist/' + c.uid+'-1-15.html'}">随机来
15
道题</a>
<ul>
<li><span th:text="${c.pointNum}">21</span> 知识点</li>
<li><span th:text="${c.questionNum}">2317</span> 试题</li>
</ul>
</div>
<div class="detail-kpoint-1" th:each="cc,ccStat:${c.childChapterList}">
<div class="kpoint-1-title k1t-0-0" id="k1t-0-0">
<h4 th:text="${cc.name}">1 集合的概念及运算</h4>
<span>1181 试题</span>
<a target="_blank" class="ten" th:href="${setting.domain + 'questionlist/' + cc.uid+'-1-15.html'}">随机来
10
道题 &gt;</a>
</div>
<div class="kpoint-1-content clearfix">
<div class="detail-kpoint-2" th:each="cc,ccStat:${cc.childChapterList}">
<h5 th:text="${cc.name}">1.1 集合的含义</h5>
<p>
<span class="">
<span class="count" th:text="${cc.questionNum}">531</span> 道题
</span>
</p>
<div class="mask" style="display: none;">
<a target="_blank" th:href="${setting.domain + 'questionlist/' + cc.uid + '-1-5.html'}" class="do">
马上做题
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--章节内容结束-->
</div>
</div>
<div class="foot">
<div class="crumbs">
<a th:href="${setting.domain}">探果题库</a>
<a th:href="${setting.domain + 'subject/' + subject.uid + '.html'}" th:utext="${subject != null} ? '&gt;' + ${subject.name}:''">高考</a>
<span th:utext="${course != null} ? '&gt;' + ${course.name}:''">理科数学</span>
</div>
</div>
<!--尾部-->
<div th:replace="include/footer :: footer"></div>
<!-- 登录 -->
<div th:replace="include/minilogin :: minilogin"></div>
</body>
<script type="text/javascript" th:src="${setting.domain + 'js/jquery-1.8.3.min.js'}" ></script>
<script type="text/javascript" th:src="${setting.domain + 'js/jquery.iDialog.js'}"></script>
<script type="text/javascript" th:src="${setting.domain + 'js/main.js'}" ></script>
<script type="text/javascript" th:src="${setting.domain + 'js/chapter.js'}" ></script>
<script type="text/javascript" th:src="${setting.domain + 'js/member/minlogin.js'}"></script>
</html>

@ -66,13 +66,8 @@
</li>
</ul>
<ul class="sc-subject clearfix">
<li>结构:</li>
<li class="selected">
<a th:href="${setting.domain + 'course/'+course.uid+'.html'}">
按知识点
</a>
</li>
<li>课本:</li>
<li th:class="${book.uid == b.uid} ? selected : ''" th:each="b,index:${bookList}"><a th:href="${setting.domain + 'book/' + b.uid + '.html'}" th:text="${b.name}">必修1</a></li>
</ul>
</div>

Loading…
Cancel
Save