首页>代码>基于SSM框架开发的在线考试系统>/OnlineExamSystem/src/main/java/com/xhu/controller/PaperController.java
package com.xhu.controller;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xhu.entity.Paper;
import com.xhu.entity.QuestionPaper;
import com.xhu.service.PaperService;

@Controller
public class PaperController {

	@Autowired
	PaperService paperService;

	@RequestMapping(value = "paperPage.do")
	public String paperPage() {
		return "paper";
	}

	@RequestMapping(value = "searchPaper.do")
	@ResponseBody
	public HashMap<String, Object> searchPaper(Paper p) {
		return paperService.searchPaper(p);
	}

	/**
	 * 预览试卷
	 * 
	 * @param p
	 * @returnsaveExam.do
	 */
	@RequestMapping(value = "showPaper.do")
	@ResponseBody
	public List<QuestionPaper> showPaper(@RequestParam("pId") int pId) {
		return paperService.showPaper(pId);
	}

	// 生成试卷
	@RequestMapping(value = "createPaper.do")
	@ResponseBody
	public String createPaper(@RequestParam("type") String type, @RequestParam("data") String data,
			@RequestParam("qname") String qname, @RequestParam("qTime") int qTime, @RequestParam("score") int score,
			@RequestParam("createTime")Date createTime) {
		//Date createTime = new Date();
		int num =  paperService.checkpapername(qname);
		if(num!=0){
			return "error";
		}
		paperService.insertPaper(qname, qTime, score, createTime);
		Paper paper = paperService.getid(qname);
		// System.out.println(paper.getpId());
		paperService.insertpid(data,paper.getPaperId()+"");
		return "success";
	}
	@RequestMapping("delpaper.do")
	@ResponseBody
	public boolean del(String iddarr) {
		return paperService.delservice(iddarr);
	}
	//检查试卷名称
/*	@RequestMapping("check.do")
	@ResponseBody
	public String check(String name) {
		
		return "success";
	}*/
}
最近下载更多
348835269  LV11 5月6日
xzg123456  LV6 2024年6月23日
nyb4613  LV8 2024年4月13日
736101636  LV19 2024年2月27日
Lemon12138  LV1 2024年1月19日
微信网友_6709209201250304  LV2 2023年12月11日
灵依ziNing  LV7 2023年7月29日
泓鼎168  LV20 2023年6月19日
lbsers  LV5 2023年5月6日
tujf13763823976  LV3 2023年3月28日
最近浏览更多
luhong  LV3 3月31日
123uio  LV1 2024年12月23日
Lyricify 2024年12月22日
暂无贡献等级
三秋桂子  LV1 2024年12月21日
初嘤嘤嘤未来  LV7 2024年12月18日
ma406805131  LV19 2024年12月17日
zolscy  LV24 2024年11月28日
shunlun8855  LV1 2024年10月29日
微信网友_7206713294606336 2024年10月12日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友