优化链接

main
tamguo 7 years ago
parent 74ac0754ce
commit 4a191e05af

@ -93,7 +93,7 @@ var vm = new Vue({
},
methods: {
getChapterTree:function(courseId){
axios.get(mainHttp + "/chapter/findChapterTreeByCourseId.html?courseId="+courseId).then(function (response) {
axios.get(mainHttp + "course/findChapterTreeByCourseId.html?courseId="+courseId).then(function (response) {
ztree = $.fn.zTree.init($("#menuTree"), setting, response.data.result);
var node = ztree.getNodeByParam("parentId", "-1");
ztree.selectNode(node);

@ -4,8 +4,6 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
import java.math.BigInteger;
import java.util.List;
@ -19,11 +17,11 @@ public class CourseEntity extends SuperEntity<CourseEntity> implements Serializa
private String name;
private BigInteger subjectId;
private String subjectId;
private BigInteger pointNum;
private String pointNum;
private BigInteger questionNum;
private String questionNum;
private Integer orders;
@ -50,27 +48,27 @@ public class CourseEntity extends SuperEntity<CourseEntity> implements Serializa
this.name = name;
}
public BigInteger getSubjectId() {
public String getSubjectId() {
return this.subjectId;
}
public void setSubjectId(BigInteger subjectId) {
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
public BigInteger getQuestionNum() {
public String getQuestionNum() {
return questionNum;
}
public void setQuestionNum(BigInteger questionNum) {
public void setQuestionNum(String questionNum) {
this.questionNum = questionNum;
}
public BigInteger getPointNum() {
public String getPointNum() {
return pointNum;
}
public void setPointNum(BigInteger pointNum) {
public void setPointNum(String pointNum) {
this.pointNum = pointNum;
}

@ -14,10 +14,6 @@ public class SubjectEntity extends SuperEntity<SubjectEntity> implements Seriali
private String name;
private String courseId;
private String courseName;
@TableField(exist=false)
private List<CourseEntity> courseList;
@ -29,22 +25,6 @@ public class SubjectEntity extends SuperEntity<SubjectEntity> implements Seriali
this.name = name;
}
public String getCourseId() {
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public List<CourseEntity> getCourseList() {
return courseList;
}

@ -1,19 +1,14 @@
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.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.model.ChapterEntity;
import com.tamguo.service.IChapterService;
import com.tamguo.service.ICourseService;
import com.tamguo.service.ISubjectService;
import com.tamguo.util.Result;
@ -22,21 +17,6 @@ public class ChapterController {
@Autowired
private IChapterService iChapterService;
@Autowired
private ICourseService iCourseService;
@Autowired
private ISubjectService iSubjectService;
@RequestMapping(value = {"/chapter/{subjectId}/{courseId}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String subjectId , @PathVariable String courseId, ModelAndView model) {
model.setViewName("chapter");
model.addObject("chapterList", iChapterService.findCourseChapter(courseId));
model.addObject("courseList", iCourseService.findBySubjectId(subjectId));
model.addObject("subjectId", subjectId);
model.addObject("course", iCourseService.find(courseId));
model.addObject("subject", iSubjectService.find(subjectId));
return model;
}
@RequestMapping(value = {"/chapter/findChapter/{courseId}.html"}, method = RequestMethod.GET)
@ResponseBody

@ -0,0 +1,65 @@
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.bind.annotation.ResponseBody;
/**
* Controller -
*
* @author tamguo
*
*/
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.model.ChapterEntity;
import com.tamguo.model.CourseEntity;
import com.tamguo.model.SubjectEntity;
import com.tamguo.service.IChapterService;
import com.tamguo.service.ICourseService;
import com.tamguo.service.ISubjectService;
import com.tamguo.util.Result;
@Controller
public class CourseController {
@Autowired
IChapterService iChapterService;
@Autowired
ICourseService iCourseService;
@Autowired
ISubjectService iSubjectService;
@RequestMapping(value = {"course/{uid}"}, method = RequestMethod.GET)
public ModelAndView index(@PathVariable String uid , ModelAndView model) {
CourseEntity course = iCourseService.find(uid);
SubjectEntity subject = iSubjectService.find(course.getSubjectId());
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(uid);
List<CourseEntity> courseList = iCourseService.findBySubjectId(course.getSubjectId());
model.addObject("chapterList", chapterList);
model.addObject("courseList", courseList);
model.addObject("course", course);
model.addObject("subject", subject);
model.setViewName("chapter");
return model;
}
@RequestMapping(value = {"course/findChapter"}, method = RequestMethod.GET)
@ResponseBody
public List<ChapterEntity> findChapterByCourseId(String courseId){
return iChapterService.findCourseChapter(courseId);
}
@RequestMapping(value = {"course/findChapterTreeByCourseId"}, method = RequestMethod.GET)
@ResponseBody
public Result findChapterTreeByCourseId(String courseId){
return Result.successResult(iChapterService.getChapterTree(courseId));
}
}

@ -1,7 +1,6 @@
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;
@ -16,7 +15,6 @@ import com.tamguo.model.CourseEntity;
import com.tamguo.model.SubjectEntity;
import com.tamguo.service.IAreaService;
import com.tamguo.service.IChapterService;
import com.tamguo.service.ICourseService;
import com.tamguo.service.ISubjectService;
import com.tamguo.util.Result;
@ -29,8 +27,6 @@ import com.tamguo.util.Result;
@Controller
public class SubjectController {
@Autowired
private ICourseService iCourseService;
@Autowired
private IChapterService iChapterService;
@Autowired
@ -41,8 +37,9 @@ public class SubjectController {
@RequestMapping(value = {"subject/{subjectId}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String subjectId , ModelAndView model) {
SubjectEntity subject = iSubjectService.find(subjectId);
CourseEntity course = iCourseService.find(subject.getCourseId());
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(subject.getCourseId());
// 获取第一个科目
CourseEntity course = subject.getCourseList().get(0);
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(course.getUid());
model.setViewName("subject");
model.addObject("subject", subject);
model.addObject("course" , course);

@ -9,7 +9,10 @@
c.orders,
c.point_num,
c.question_num,
c.subject_id
c.subject_id,
c.seo_title,
c.seo_keywords,
c.seo_description
FROM
tiku_course c
WHERE

@ -17,7 +17,7 @@ $(function(){
var courseId = $(this).attr("courseid");
$.ajax({
type : "get",
url : mainHttp + "chapter/findChapter/" +courseId+".html",
url : mainHttp + "course/findChapter.html?courseId=" +courseId+".html",
async : true,
dataType : "json",
success : function(data) {// 返回数据根据结果进行相应的处理,无论请求成功还是失败,都会走这个方法的

@ -32,10 +32,10 @@
</span>
<ul class="contain-ul">
<li class="contain-li">
<a th:href="${setting.domain + 'subject/' + subjectId + '.html'}" class="">考试首页</a>
<a th:href="${setting.domain + 'subject/' + subject.uid + '.html'}" class="">考试首页</a>
</li>
<li class="contain-li curr">
<a class="curr " th:href="${setting.domain + 'chapter/'+subjectId+'/'+course.uid+'.html'}">章节学习</a>
<a class="curr " th:href="${setting.domain + 'course/'+course.uid+'.html'}">章节学习</a>
</li>
<li class="contain-li">
<a class="" th:href="${setting.domain + 'paperlist/' + subjectId + '/'+course.uid+'-'+setting.PAPER_TYPE_ZHENTI+'-0-0-1.html'}">真题试卷</a>
@ -60,7 +60,7 @@
<li>科目:</li>
<li th:class="${c.uid == course.uid} ? 'selected' : ''" th:each="c,cStat:${courseList}">
<a th:href="${setting.domain + 'chapter/'+c.subjectId+'/'+c.uid+'.html'}" th:text="${c.name}">
<a th:href="${setting.domain + 'course/'+c.uid+'.html'}" th:text="${c.name}">
理科数学
</a>
</li>
@ -69,7 +69,7 @@
<li>结构:</li>
<li class="selected">
<a th:href="${setting.domain + 'chapter/'+subjectId+'/'+course.uid+'.html'}">
<a th:href="${setting.domain + 'course/'+course.uid+'.html'}">
按知识点
</a>
</li>

@ -32,7 +32,7 @@
</li>
<li class="contain-li">
<a class="" th:href="${setting.domain + 'chapter/'+subjectId+'/'+courseId+'.html'}">章节学习</a>
<a class="" th:href="${setting.domain + 'course/'+courseId+'.html'}">章节学习</a>
</li>
<li class="contain-li">
<a th:class="${paperType == setting.PAPER_TYPE_ZHENTI} ? 'curr' : '' " th:href="${setting.domain + 'paperlist/' + subjectId + '/'+courseId+'-'+setting.PAPER_TYPE_ZHENTI+'-0-0-1.html'}">真题试卷</a>

@ -37,7 +37,7 @@
<a th:href="${setting.domain + 'subject/' + subject.uid + '.html'}" class=" curr ">考试首页</a>
</li>
<li class="contain-li curr">
<a class="" th:href="${setting.domain + 'chapter/' + subject.uid + '/'+course.uid+'.html'}">章节学习</a>
<a class="" 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>

Loading…
Cancel
Save