main
tamguo 7 years ago
parent e5f9e16752
commit b431257102

@ -36,18 +36,23 @@ public class CourseController {
@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;
try {
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;
} catch (Exception e) {
model.setViewName("404");
return model;
}
}
@RequestMapping(value = {"course/findChapter"}, method = RequestMethod.GET)

@ -46,45 +46,57 @@ public class PaperController {
@RequestMapping(value = {"paperlist/{subjectId}-{courseId}-{paperType}-{year}-{area}-{pageNum}"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String subjectId , @PathVariable String courseId , @PathVariable String paperType,
@PathVariable String year , @PathVariable String area , @PathVariable Integer pageNum, ModelAndView model) {
model.setViewName("paperlist");
CourseEntity course = iCourseService.find(courseId);
List<CourseEntity> courseList = iCourseService.findBySubjectId(subjectId);
SubjectEntity subject = iSubjectService.find(subjectId);
List<AreaEntity> areaList = iAreaService.findRootArea();
PageUtils page = PageUtils.getPage(iPaperService.findList(subjectId , courseId , paperType , year , area , pageNum));
if(course == null) {
course = courseList.get(0);
}
Long total = iPaperService.getPaperTotal();
model.addObject("courseList", courseList);
model.addObject("subject", subject);
model.addObject("course", course);
model.addObject("areaList", areaList);
model.addObject("paperPage" , page);
model.addObject("total" , total);
model.addObject("courseId", course.getUid());
model.addObject("paperType", paperType);
model.addObject("year", year);
model.addObject("area", area);
return model;
try {
model.setViewName("paperlist");
CourseEntity course = iCourseService.find(courseId);
List<CourseEntity> courseList = iCourseService.findBySubjectId(subjectId);
SubjectEntity subject = iSubjectService.find(subjectId);
List<AreaEntity> areaList = iAreaService.findRootArea();
PageUtils page = PageUtils.getPage(iPaperService.findList(subjectId , courseId , paperType , year , area , pageNum));
if(course == null) {
course = courseList.get(0);
}
Long total = iPaperService.getPaperTotal();
model.addObject("courseList", courseList);
model.addObject("subject", subject);
model.addObject("course", course);
model.addObject("areaList", areaList);
model.addObject("paperPage" , page);
model.addObject("total" , total);
model.addObject("courseId", course.getUid());
model.addObject("paperType", paperType);
model.addObject("year", year);
model.addObject("area", area);
return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
}
@RequestMapping(value = {"/paper/{paperId}.html"}, method = RequestMethod.GET)
public ModelAndView indexAction(@PathVariable String paperId , ModelAndView model){
model.setViewName("paper");
PaperEntity paper = iPaperService.find(paperId);
model.addObject("paper", paper);
model.addObject("subject", StringUtils.isEmpty(paper.getSubjectId()) ? null : iSubjectService.find(paper.getSubjectId()));
model.addObject("course", StringUtils.isEmpty(paper.getCourseId()) ? null : iCourseService.find(paper.getCourseId()));
model.addObject("questionList", iQuestionService.findPaperQuestion(paperId));
try {
model.setViewName("paper");
PaperEntity paper = iPaperService.find(paperId);
model.addObject("paper", paper);
model.addObject("subject", StringUtils.isEmpty(paper.getSubjectId()) ? null : iSubjectService.find(paper.getSubjectId()));
model.addObject("course", StringUtils.isEmpty(paper.getCourseId()) ? null : iCourseService.find(paper.getCourseId()));
model.addObject("questionList", iQuestionService.findPaperQuestion(paperId));
// 获取推荐试卷
model.addObject("zhentiPaperList", iPaperService.featuredPaper(TamguoConstant.ZHENGTI_PAPER_ID, paper.getSubjectId()));
model.addObject("moniPaperList", iPaperService.featuredPaper(TamguoConstant.MONI_PAPER_ID, paper.getSubjectId()));
model.addObject("yatiPaperList", iPaperService.featuredPaper(TamguoConstant.YATI_PAPER_ID, paper.getSubjectId()));
model.addObject("hotPaperList", iPaperService.findHotPaper(paper.getSubjectId(), paper.getCourseId()));
return model;
// 获取推荐试卷
model.addObject("zhentiPaperList", iPaperService.featuredPaper(TamguoConstant.ZHENGTI_PAPER_ID, paper.getSubjectId()));
model.addObject("moniPaperList", iPaperService.featuredPaper(TamguoConstant.MONI_PAPER_ID, paper.getSubjectId()));
model.addObject("yatiPaperList", iPaperService.featuredPaper(TamguoConstant.YATI_PAPER_ID, paper.getSubjectId()));
model.addObject("hotPaperList", iPaperService.findHotPaper(paper.getSubjectId(), paper.getCourseId()));
return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
}
@RequestMapping(value = {"/paper/area/{areaId}-{type}.html"}, method = RequestMethod.GET)

@ -35,27 +35,33 @@ public class QuestionContrller {
@RequestMapping(value = {"questionlist/{chapterId}-{offset}-{limit}"}, method = RequestMethod.GET)
public ModelAndView questionList(@PathVariable String chapterId , @PathVariable Integer offset ,
@PathVariable Integer limit , ModelAndView model){
model.setViewName("questionList");
try {
model.setViewName("questionList");
ChapterEntity chapter = iChapterService.findById(chapterId);
CourseEntity course = iCourseService.find(chapter.getCourseId());
SubjectEntity subject = iSubjectService.find(course.getSubjectId());
ChapterEntity parentChapter = iChapterService.findById(chapter.getParentId());
ChapterEntity nextChapter = iChapterService.findNextPoint(chapter.getParentId() , chapter.getOrders());
ChapterEntity chapter = iChapterService.findById(chapterId);
CourseEntity course = iCourseService.find(chapter.getCourseId());
SubjectEntity subject = iSubjectService.find(course.getSubjectId());
ChapterEntity parentChapter = iChapterService.findById(chapter.getParentId());
ChapterEntity nextChapter = iChapterService.findNextPoint(chapter.getParentId() , chapter.getOrders());
Page<QuestionEntity> page = new Page<>();
page.setCurrent(offset);
page.setSize(limit);
Page<QuestionEntity> questionList = iQuestionService.findByChapterId(chapterId , page);
model.addObject("subject", subject);
model.addObject("course", course);
model.addObject("chapter", chapter);
model.addObject("parentChapter" , parentChapter);
model.addObject("nextChapter" , nextChapter);
model.addObject("questionList", questionList);
model.addObject("subjectId", course.getSubjectId());
model.addObject("courseId", course.getUid());
return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
Page<QuestionEntity> page = new Page<>();
page.setCurrent(offset);
page.setSize(limit);
Page<QuestionEntity> questionList = iQuestionService.findByChapterId(chapterId , page);
model.addObject("subject", subject);
model.addObject("course", course);
model.addObject("chapter", chapter);
model.addObject("parentChapter" , parentChapter);
model.addObject("nextChapter" , nextChapter);
model.addObject("questionList", questionList);
model.addObject("subjectId", course.getSubjectId());
model.addObject("courseId", course.getUid());
return model;
}
/**
@ -66,17 +72,23 @@ public class QuestionContrller {
*/
@RequestMapping(value = {"/question/{uid}.html"}, method = RequestMethod.GET)
public ModelAndView question(@PathVariable String uid , ModelAndView model){
model.setViewName("question");
QuestionEntity question = iQuestionService.findNormalQuestion(uid);
question.setQuestionType(QuestionType.getQuestionType(question.getQuestionType()).getDesc());
model.addObject("question", question);
try {
model.setViewName("question");
QuestionEntity question = iQuestionService.findNormalQuestion(uid);
question.setQuestionType(QuestionType.getQuestionType(question.getQuestionType()).getDesc());
model.addObject("question", question);
// 推荐试题
model.addObject("featuredQuestionList", iQuestionService.featuredQuestion(question.getSubjectId(),question.getCourseId()));
return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
// 推荐试题
model.addObject("featuredQuestionList", iQuestionService.featuredQuestion(question.getSubjectId(),question.getCourseId()));
return model;
}
@RequestMapping(value = {"/question/getQuestion/{uid}.html"}, method = RequestMethod.GET)
@RequestMapping(value = {"question/getQuestion/{uid}"}, method = RequestMethod.GET)
@ResponseBody
public Result getQuestion(@PathVariable String uid , ModelAndView model){
return Result.successResult(iQuestionService.select(uid));

@ -24,7 +24,7 @@ public class SchoolController {
@Autowired
private ISchoolService iSchoolService;
@RequestMapping(value = {"/school/area/{areaId}.html"}, method = RequestMethod.GET)
@RequestMapping(value = {"school/area/{areaId}"}, method = RequestMethod.GET)
@ResponseBody
public List<SchoolEntity> findSchoolByAreaId(@PathVariable String areaId , ModelAndView model){
return iSchoolService.findEliteSchoolPaper(areaId);
@ -35,7 +35,7 @@ public class SchoolController {
* @param areaId
* @return
*/
@RequestMapping(value = {"/school/findByAreaId.html"}, method = RequestMethod.GET)
@RequestMapping(value = {"school/findByAreaId"}, method = RequestMethod.GET)
@ResponseBody
public List<SchoolEntity> findSchoolByAreaId(String areaId){
return iSchoolService.findSchoolByAreaId(areaId);

@ -36,17 +36,23 @@ 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 = subject.getCourseList().get(0);
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(course.getUid());
model.setViewName("subject");
model.addObject("subject", subject);
model.addObject("course" , course);
model.addObject("courseList", subject.getCourseList());
model.addObject("chapterList" , chapterList);
model.addObject("areaList", iAreaService.findRootArea());
return model;
try {
SubjectEntity subject = iSubjectService.find(subjectId);
// 获取第一个科目
CourseEntity course = subject.getCourseList().get(0);
List<ChapterEntity> chapterList = iChapterService.findCourseChapter(course.getUid());
model.setViewName("subject");
model.addObject("subject", subject);
model.addObject("course" , course);
model.addObject("courseList", subject.getCourseList());
model.addObject("chapterList" , chapterList);
model.addObject("areaList", iAreaService.findRootArea());
return model;
} catch (Exception e) {
model.setViewName("404");
return model;
}
}
@RequestMapping(value = {"subject/getCourseTree.html"}, method = RequestMethod.GET)

Loading…
Cancel
Save