parent
							
								
									17faaf8054
								
							
						
					
					
						commit
						27db8e217e
					
				@ -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<QuestionEntity>{
 | 
				
			||||
 | 
				
			||||
	List<QuestionEntity> findPage(String chapterId, Pagination page);
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
}
 | 
				
			||||
@ -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<QuestionEntity> 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;
 | 
				
			||||
	}
 | 
				
			||||
 | 
				
			||||
}
 | 
				
			||||
@ -0,0 +1,9 @@
 | 
				
			||||
package com.tamguo.service;
 | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.plugins.Page;
 | 
				
			||||
import com.tamguo.model.QuestionEntity;
 | 
				
			||||
 | 
				
			||||
public interface IQuestionService {
 | 
				
			||||
 | 
				
			||||
	Page<QuestionEntity> findPage(String chapterId , Page<QuestionEntity> page);
 | 
				
			||||
}
 | 
				
			||||
@ -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<QuestionEntity> findPage(String chapterId, Page<QuestionEntity> page) {
 | 
				
			||||
		return page.setRecords(questionMapper.findPage(chapterId , page));
 | 
				
			||||
	}
 | 
				
			||||
 | 
				
			||||
}
 | 
				
			||||
@ -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<QuestionEntity> page =  new Page<QuestionEntity>(current, size);
 | 
				
			||||
		return Result.successResult(iQuestionService.findPage(chapterId, page));
 | 
				
			||||
	}
 | 
				
			||||
	
 | 
				
			||||
}
 | 
				
			||||
 | 
				
			||||
@ -0,0 +1,25 @@
 | 
				
			||||
<?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.QuestionMapper">
 | 
				
			||||
 | 
				
			||||
	<select id="findPage" resultType="QuestionEntity">
 | 
				
			||||
		SELECT
 | 
				
			||||
			q.uid,
 | 
				
			||||
			q.analysis,
 | 
				
			||||
			q.answer,
 | 
				
			||||
			q.chapter_id,
 | 
				
			||||
			q.content,
 | 
				
			||||
			q.question_type,
 | 
				
			||||
			q.course_id,
 | 
				
			||||
			q.review_point,
 | 
				
			||||
			q.year,
 | 
				
			||||
			q.score,
 | 
				
			||||
			q.subject_id,
 | 
				
			||||
			q.audit_status
 | 
				
			||||
		FROM
 | 
				
			||||
			tiku_question q
 | 
				
			||||
		WHERE
 | 
				
			||||
			q.chapter_id = #{chapterId}
 | 
				
			||||
		Order By q.uid desc
 | 
				
			||||
	</select>
 | 
				
			||||
</mapper>
 | 
				
			||||
@ -0,0 +1,54 @@
 | 
				
			||||
var vm = new Vue({
 | 
				
			||||
	el:'#app',
 | 
				
			||||
	data : {
 | 
				
			||||
	   docked: false,
 | 
				
			||||
       open: false,
 | 
				
			||||
       position: 'left',
 | 
				
			||||
       panel: '',
 | 
				
			||||
       total:0,
 | 
				
			||||
       question:{},
 | 
				
			||||
       topUrl:"",
 | 
				
			||||
       nextUrl:null,
 | 
				
			||||
       warnOpen:false,
 | 
				
			||||
       warnMessage:'',
 | 
				
			||||
       courseList:[]
 | 
				
			||||
	},
 | 
				
			||||
	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<vm.courseList.length ; i++){
 | 
				
			||||
      		    		vm.courseList[i].url = mainHttp + "chapter/" + vm.courseList[i].subjectId+"/"+vm.courseList[i].uid+".html";
 | 
				
			||||
      		    	}
 | 
				
			||||
				}
 | 
				
			||||
      	  	});
 | 
				
			||||
		},
 | 
				
			||||
		getQuestion(chapterId , current , size){
 | 
				
			||||
			axios({method: 'post',url: mainHttp + 'question/'+subjectId+'/'+chapterId+'-'+current+'-'+size+'.html'}).then(function(response){
 | 
				
			||||
      		    if(response.data.code == 0){
 | 
				
			||||
      		    	if(response.data.result.records.length > 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);
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue