diff --git a/tamguo-mobile/src/main/java/com/tamguo/dao/QuestionMapper.java b/tamguo-mobile/src/main/java/com/tamguo/dao/QuestionMapper.java new file mode 100644 index 0000000..d896665 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/dao/QuestionMapper.java @@ -0,0 +1,14 @@ +package com.tamguo.dao; + +import java.util.List; + +import com.baomidou.mybatisplus.plugins.pagination.Pagination; +import com.tamguo.config.dao.SuperMapper; +import com.tamguo.model.QuestionEntity; + +public interface QuestionMapper extends SuperMapper{ + + List findPage(String chapterId, Pagination page); + + +} diff --git a/tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java b/tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java index e43097b..a892206 100644 --- a/tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java +++ b/tamguo-mobile/src/main/java/com/tamguo/model/CourseEntity.java @@ -19,7 +19,7 @@ public class CourseEntity extends SuperEntity implements Serializa private String name; - private BigInteger subjectId; + private String subjectId; private BigInteger pointNum; @@ -50,11 +50,11 @@ public class CourseEntity extends SuperEntity 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; } diff --git a/tamguo-mobile/src/main/java/com/tamguo/model/QuestionEntity.java b/tamguo-mobile/src/main/java/com/tamguo/model/QuestionEntity.java new file mode 100644 index 0000000..4fe7584 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/model/QuestionEntity.java @@ -0,0 +1,172 @@ +package com.tamguo.model; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.tamguo.config.dao.SuperEntity; + +/** + * The persistent class for the tiku_question database table. + * + */ +@TableName(value="tiku_question") +public class QuestionEntity extends SuperEntity implements Serializable { + private static final long serialVersionUID = 1L; + + private String analysis; + + private String paperId; + + private String answer; + + private String chapterId; + + private String questionType; + + private String content; + + private String subjectId; + + private String courseId; + + private String reviewPoint; + + private String year; + + private Integer score; + + private String auditStatus; + + @TableField(exist=false) + private String courseName; + + @TableField(exist=false) + private String chapterName; + + @TableField(exist=false) + private String subjectName; + + public QuestionEntity() { + } + + public String getAnalysis() { + return this.analysis; + } + + public void setAnalysis(String analysis) { + this.analysis = analysis; + } + + public String getAnswer() { + return this.answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + public String getChapterId() { + return this.chapterId; + } + + public void setChapterId(String chapterId) { + this.chapterId = chapterId; + } + + public String getQuestionType() { + return this.questionType; + } + + public void setQuestionType(String questionType) { + this.questionType = questionType; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getReviewPoint() { + return reviewPoint; + } + + public void setReviewPoint(String reviewPoint) { + this.reviewPoint = reviewPoint; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public String getPaperId() { + return paperId; + } + + public void setPaperId(String paperId) { + this.paperId = paperId; + } + + 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 String getChapterName() { + return chapterName; + } + + public void setChapterName(String chapterName) { + this.chapterName = chapterName; + } + + public String getSubjectId() { + return subjectId; + } + + public void setSubjectId(String subjectId) { + this.subjectId = subjectId; + } + + public String getSubjectName() { + return subjectName; + } + + public void setSubjectName(String subjectName) { + this.subjectName = subjectName; + } + + public String getAuditStatus() { + return auditStatus; + } + + public void setAuditStatus(String auditStatus) { + this.auditStatus = auditStatus; + } + +} \ No newline at end of file diff --git a/tamguo-mobile/src/main/java/com/tamguo/service/IQuestionService.java b/tamguo-mobile/src/main/java/com/tamguo/service/IQuestionService.java new file mode 100644 index 0000000..de70269 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/service/IQuestionService.java @@ -0,0 +1,9 @@ +package com.tamguo.service; + +import com.baomidou.mybatisplus.plugins.Page; +import com.tamguo.model.QuestionEntity; + +public interface IQuestionService { + + Page findPage(String chapterId , Page page); +} diff --git a/tamguo-mobile/src/main/java/com/tamguo/service/impl/QuestionService.java b/tamguo-mobile/src/main/java/com/tamguo/service/impl/QuestionService.java new file mode 100644 index 0000000..b28cd01 --- /dev/null +++ b/tamguo-mobile/src/main/java/com/tamguo/service/impl/QuestionService.java @@ -0,0 +1,22 @@ +package com.tamguo.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.plugins.Page; +import com.tamguo.dao.QuestionMapper; +import com.tamguo.model.QuestionEntity; +import com.tamguo.service.IQuestionService; + +@Service +public class QuestionService implements IQuestionService{ + + @Autowired + QuestionMapper questionMapper; + + @Override + public Page findPage(String chapterId, Page page) { + return page.setRecords(questionMapper.findPage(chapterId , page)); + } + +} diff --git a/tamguo-mobile/src/main/java/com/tamguo/web/QuestionController.java b/tamguo-mobile/src/main/java/com/tamguo/web/QuestionController.java index ddcdc9a..9afe13d 100644 --- a/tamguo-mobile/src/main/java/com/tamguo/web/QuestionController.java +++ b/tamguo-mobile/src/main/java/com/tamguo/web/QuestionController.java @@ -1,14 +1,41 @@ package com.tamguo.web; +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.baomidou.mybatisplus.plugins.Page; +import com.tamguo.model.QuestionEntity; +import com.tamguo.service.IQuestionService; +import com.tamguo.util.Result; @Controller public class QuestionController { - - @RequestMapping(path= {"question","/"}) - public String index() { + + @Autowired + IQuestionService iQuestionService; + + @RequestMapping(path= {"question/{subjectId}/{chapterId}-{current}-{size}"}) + public String index(@PathVariable String subjectId , @PathVariable String chapterId , + @PathVariable String current ,@PathVariable String size , + ModelAndView model) { + model.addObject("chapterId", chapterId); + model.addObject("current" , current); + model.addObject("size", size); return "question"; } + @RequestMapping(path= {"question/{subjectId}/{chapterId}-{current}-{size}"} , method=RequestMethod.POST) + @ResponseBody + public Result getQuestion(@PathVariable String chapterId , + @PathVariable Integer current ,@PathVariable Integer size , + ModelAndView model) { + Page page = new Page(current, size); + return Result.successResult(iQuestionService.findPage(chapterId, page)); + } + } diff --git a/tamguo-mobile/src/main/resources/mappers/QuestionMapper.xml b/tamguo-mobile/src/main/resources/mappers/QuestionMapper.xml new file mode 100644 index 0000000..c6c7211 --- /dev/null +++ b/tamguo-mobile/src/main/resources/mappers/QuestionMapper.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/tamguo-mobile/src/main/resources/static/js/chapter/main.js b/tamguo-mobile/src/main/resources/static/js/chapter/main.js index 445e071..193e56d 100644 --- a/tamguo-mobile/src/main/resources/static/js/chapter/main.js +++ b/tamguo-mobile/src/main/resources/static/js/chapter/main.js @@ -3,16 +3,25 @@ var vm = new Vue({ data : { courseList:[], chapterList:[], + secondLevelChapterList:[], + thirdLevelChapterList:[], docked: false, open: true, position: 'left', - panel: '' + panel: '', + index:1, + secondLevelName:null, + thirdLevelName:null, + mainHttp:mainHttp }, methods:{ findCourseList(subjectId){ axios({method: 'post',url: mainHttp + 'chapter/findCourseList.html?subjectId='+subjectId}).then(function(response){ if(response.data.code == 0){ vm.courseList = response.data.result; + for(var i=0 ; i 0){ + vm.question = response.data.result.records[0]; + } + vm.total = response.data.result.total; + + + // 处理上一页下一页 + var previous = parseInt(current)-1; + var next = parseInt(current)+1; + if(previous <= 0){ + previous = 1; + } + if(next >= vm.total){ + next = vm.total; + } + vm.topUrl = mainHttp + 'question/'+subjectId+'/'+chapterId+'-'+previous+'-'+size+'.html'; + vm.nextUrl = mainHttp + 'question/'+subjectId+'/'+chapterId+'-'+next+'-'+size+'.html'; + } + }); + } + } +}); + +vm.findCourseList(subjectId); +vm.getQuestion(chapterId , current , size); \ No newline at end of file diff --git a/tamguo-mobile/src/main/resources/templates/chapter.html b/tamguo-mobile/src/main/resources/templates/chapter.html index ab8ea59..0f4fa1f 100644 --- a/tamguo-mobile/src/main/resources/templates/chapter.html +++ b/tamguo-mobile/src/main/resources/templates/chapter.html @@ -9,10 +9,20 @@ +
- + @@ -23,47 +33,68 @@ - + - - - 当前位置 - 理科数学 + + 理科数学 + + + + 理科数学 + {{secondLevelName}} + + + + 理科数学 + {{secondLevelName}} + {{thirdLevelName}} - -
- {{chapter.name}} - - - - {{cha.name}} - - {{cha.name}} - - + + + + {{chapter.name}} + + + + + + + + + {{chapter.name}} + + + + + + + + + {{chapter.name}} 题目数:{{chapter.questionNum}} + - - - - - + -
-
- - - - - {{course.name}} - - - - 关闭 - - - + + + + + + + 首页 + + + + {{course.name}} + + + + 关闭 + + +
diff --git a/tamguo-mobile/src/main/resources/templates/question.html b/tamguo-mobile/src/main/resources/templates/question.html index 7e18167..97a8bb9 100644 --- a/tamguo-mobile/src/main/resources/templates/question.html +++ b/tamguo-mobile/src/main/resources/templates/question.html @@ -43,57 +43,57 @@ - +

如图,圆O 1 与圆O 2 内切于点A,其半径分别为r 1 与r 2 (r 1 >r 2 ).圆O 1 的弦AB交圆O 2 于点C(O 1 不在AB上)。

求证:AB∶AC为定值。

- + B - +

苯巴比妥属于巴比妥类镇静催眠药;佐匹克隆属于环吡咯酮类镇静催眠药;阿普唑仑属于苯二氮䓬类镇静催眠药,同类药物还有地西泮等,苯妥英钠属于乙内酰脲类抗癫痫药。

-
- - - 理科数学 - - - 文科数学 - - - 物理 - - - 英语 - - - 关闭 - - - + + + + 首页 + + + + {{course.name}} + + + + 关闭 + + + - - - - - + + + + + + - + + \ No newline at end of file