Java项目:在线高中考试系统(java+SSM+Jsp+Mysql+Maven)
源码获取:博客首页 "资源" 里下载!
项目分为前台和后台,前台主要为学生角色、后台主要为管理员角色。
管理员添加试题和发布试卷,学生负责在线考试、在线查看成绩和错题记录列表等。
管理员功能有:年级管理、课程管理、试题管理、试卷管理、学生管理等。
运行环境:jdk1.8、mysql5.x、eclipse、tomcat8.5\7.0、maven3.5\3.6。
登录控制层:
@Controller
public class LoginController {@Autowiredprivate StudentService studentService;@Autowiredprivate TeacherService teacherService;@Autowiredprivate QuestionService questionService;@Autowiredprivate PaperService paperService;@Autowiredprivate ClasseService classeService;@Autowiredprivate RecordService recordService;@RequestMapping("/")public String view(Model model){//查询所有用户int teas=teacherService.queryCountAll();int stus=studentService.queryCOuntALlstu();int alllogers=teas+stus;//统计试题int allQues=questionService.queryCountAllQues();//统计试卷int allPaps=paperService.queryCountALlPaps();model.addAttribute("allPaps",allPaps);model.addAttribute("allQues",allQues);model.addAttribute("alllogers",alllogers);return "stage/prexam";}//后台切换到前台登录@RequestMapping("/foreLogin")public String foreLogin(){return "stage/login";}//前台切换到后台登录@RequestMapping("/backLogin")public String backLogin(){return "stage/loginx";}//后台教师登录验证@ResponseBody@RequestMapping("/backLogin/check")public Object backCheck(Teacher teacher, HttpServletRequest request){AjaxResult result=new AjaxResult();HttpSession session=request.getSession();Teacher teac=teacherService.check(teacher);if(teac!=null){session.setAttribute("logerd",teac);result.setSuccess(true);}else {result.setSuccess(false);}return result;}@RequestMapping("/index")public String index(Model model){//查询所有用户int teas=teacherService.queryCountAll();int stus=studentService.queryCOuntALlstu();int alllogers=teas+stus;//统计试题int allQues=questionService.queryCountAllQues();//统计试卷int allPaps=paperService.queryCountALlPaps();List<Record> ScoreHStu=recordService.queryRankScoreRecord();List<Record> AccHStu=recordService.queryRankAccRecord();model.addAttribute("ScoreHStu",ScoreHStu);model.addAttribute("AccHStu",AccHStu);model.addAttribute("allPaps",allPaps);model.addAttribute("allQues",allQues);model.addAttribute("alllogers",alllogers);return "index";}//前台学生登录考试@ResponseBody@RequestMapping("/foreCheck/check")public Object foreCheck(Student student, HttpServletRequest request){AjaxResult result=new AjaxResult();HttpSession session=request.getSession();Student stud=studentService.check(student);if(stud!=null){session.setAttribute("loger",stud);result.setSuccess(true);}else {result.setSuccess(false);}return result;}//前台登录到展示页面@RequestMapping("/indexprexam")public String indexprexam(){return "stage/prexamed";}//退出系统@RequestMapping(value = {"*/logout","/logout","teacher/logout"})public String logout(HttpSession session) {//session里可能不止存放一个数据,移除麻烦,所以让其失效跟直接session.invalidate();return "redirect:/";}//学生注册//去添加页面@RequestMapping("/prexam/toAddStudent")public String toAddStudent(Model model){List<Classe> allClasees = classeService.getAll();model.addAttribute("allClasees",allClasees);return "stage/studentAdd";}//添加具体操作@RequestMapping("/prexam/AddStudent")public String AddStudent(Student student){studentService.AddStudent(student);return "redirect:/foreLogin";}@RequestMapping("/zhao")public String zhao(){return "stage/zhao";}
}
学生管理控制层:
@Controller
@RequestMapping("/student")
public class StudentController {@Autowiredprivate ClasseMapper classeMapper;@Autowiredprivate StudentService studentService;
//查看所有学生@RequestMapping("/getAllStudent")public String getAllStudent(Model model){List<Student> students = studentService.getAll();model.addAttribute("students",students);return "student/studentList";}//修改编辑功能,先获取该id得学生信息@RequestMapping("/{id}")public String updateStudent(@PathVariable("id") Integer id,Model model){Student student=studentService.getStudentById(id);List<Classe> classes = classeMapper.queryAll();model.addAttribute("classes",classes);model.addAttribute("student",student);return "student/studentEdit";}
//更改学生信息@RequestMapping("/editStudent")public String EditStudent(Student student){studentService.EditStudent(student);return "redirect:/student/getAllStudent";}
//删除学生@RequestMapping("/deleteStudent/{id}")public String deleteStudent(@PathVariable("id") Integer id){studentService.deleteById(id);return "redirect:/student/getAllStudent";}
}
问题管理控制层:
@Controller
@RequestMapping("/question")
public class QuestionController {@Autowiredprivate QuestionService questionService;@Autowiredprivate TeacherService teacherService;@Autowiredprivate PaperService paperService;//查看所有试题 pagesize控制每页数据条数@RequestMapping("/getAllQuestion")public String getAllQuestion(Question question,@RequestParam(defaultValue = "1") int pageNum,@RequestParam(defaultValue = "4") int pageSize,Model model){//查找所有题目课程和所有类型,且去重List<Question> questionCourses=questionService.queryAllCourse();questionCourses.add(new Question("bug","all"));List<Question> questionTypes=questionService.queryAllType();questionTypes.add(new Question("k","bug"));String questionCourseBef = question.getQuestionCourse();String questionCourseresRes="";if(questionCourseBef==null){//默认查询所有questionCourseresRes="all";}else {questionCourseresRes=questionCourseBef;}//若是第一次查询则用上次提交的表单中的类型、课程,若是第二次查询则延用上次类型String questionTypeBef=question.getQuestionType();String questionTypesRes="";if(questionTypeBef==null){//默认查询所有questionTypesRes="k";}else {questionTypesRes=questionTypeBef;}List<Question> questionids=paperService.queryALlQuestionId();List<Integer> quesIds=new ArrayList<>();for(Question qid:questionids){quesIds.add(qid.getQuestionId());}model.addAttribute("quesIds",quesIds);PageHelper.startPage(pageNum,pageSize);//这行是重点,表示从pageNum页开始,每页pageSize条数据List<Question> questions = questionService.getAll(question);PageInfo<Question> pageInfo = new PageInfo<Question>(questions);model.addAttribute("questionCourseresRes",questionCourseresRes);model.addAttribute("questionTypesRes",questionTypesRes);model.addAttribute("questionTypes",questionTypes);model.addAttribute("questionCourses",questionCourses);model.addAttribute("pageInfo",pageInfo);return "question/questionList";}
//试题添加或者修改操作,先去添加页面@RequestMapping("/toAddQuestion")public String toAddQuestion(Model model){List<Question> questionCourses=questionService.queryAllCourse();List<Question> questionTypes=questionService.queryAllType();model.addAttribute("questionTypes",questionTypes);model.addAttribute("questionCourses",questionCourses);return "question/questionAdd";}//添加具体操作@RequestMapping("/addQuestion")public String addQuestion(Question question){questionService.addQuestion(question);return "redirect:/question/getAllQuestion";}//试题去修改页面@RequestMapping("/toEditQuestion/{id}")public String toEditQuestion(@PathVariable("id") Integer id,Model model){List<Question> questionCourses=questionService.queryAllCourse();List<Question> questionTypes=questionService.queryAllType();Question question=questionService.getQuestionById(id);model.addAttribute("questionTypes",questionTypes);model.addAttribute("questionCourses",questionCourses);model.addAttribute("question",question);return "question/questionEdit";}//修改具体操作@RequestMapping("/EditQuestion")public String EditQuestion(Question question){questionService.editQuestion(question);return "redirect:/question/getAllQuestion";}//试题删除@RequestMapping("/deleteQuestion/{id}")public String deleteQuestionById(@PathVariable("id") Integer id){questionService.deleteQuestionById(id);return "redirect:/question/getAllQuestion";}}
源码获取:博客首页 "资源" 里下载!
相关文章:

asp.net mvc 学习
Routing讲解: http://www.cnblogs.com/wangiqngpei557/p/3379095.html Filter讲解: http://www.cnblogs.com/ymnets/p/3452407.html ASP.NET MVC 支持以下类型的操作筛选器: 授权筛选器。 这些筛选器用于实现 IAuthorizationFilter 和做出关于…

Linux数据库性能优化--文件系统相关优化
实际也中也用到下文中所说的内存文件系统1、ramfs 记得是32位文件系统安装oracle 为oracle分配SGA突破1.7G大小限制2、mmap 的文件可以放在tmpfs挂载的文件系统中http://www.ibm.com/developerworks/cn/linux/management/tune/index.html1. 引言实践证明Lin…
jQuery Mobile的学习时间bottonbutton的事件学习
版权声明:本文为博主原创文章。未经博主同意不得转载。https://blog.csdn.net/xmt1139057136/article/details/27700521 程序猿都非常懒,你懂的! 生命的绝唱来机仅仅争朝夕,如诗的年华更需惜时如金。不要让今天的懈怠成为一生的痛…

C++中 public,protected, private 访问标号小结
第一:private, public, protected 访问标号的访问范围。 private: 只能由1.该类中的函数、2.其友元函数访问。 不能被任何其他访问,该类的对象也不能访问。 protected: 可以被1.该类中的函数、2.子类的函数、以及3.其友元函数…

Java项目:学生管理系统(java+Springboot+Maven+mybatis+Vue+Mysql)
源码获取:博客首页 "资源" 里下载! 一、项目简述 本系统功能包括: 学生管理,教师管理,课程管理,成绩管理,系统管理等等。 二、项目运行 环境配置: Jdk1.8 Tomcat8.5 M…

UVA 11752 超级幂
UVA 11752 超级幂 Z - The Super PowersTime Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 11752Description 题意:定义一个数为超级幂,当这个数能表示成至少两个不同数字的幂时。如162^4&#x…

Awstats
c是一个非常简洁而且强大的统计工具。它可以统计您站点的如下信息:一:访问量,访问次数,页面浏览量,点击数,数据流量等精确到每月、每日、每小时的数据二:访问者国家、访问者IP、操作系统、浏览器…

fixture详细介绍-作为参数传入,error和failed区别
前言 fixture是pytest的核心功能,也是亮点功能,熟练掌握fixture的使用方法,pytest用起来才会得心应手! fixture简介 fixture的目的是提供一个固定基线,在该基线上测试可以可靠地和重复地执行。fixture提供了区别于传统…

哈佛结构和冯诺依曼结构区别。
哈佛结构是一种将程序指令存储和数据存储分开的存储器结构。中央处理器首先到程序指令存储器中读取程序指令内容,解码后得到数据地址,再到相应的数据存储 器中读取数据,并进行下一步的操作(通常是执行)。程序指令存储和…

js 数据函数
//shift:删除原数组第一项,并返回删除元素的值;如果数组为空则返回undefined var a [1,2,3,4,5]; var b a.shift(); //a:[2,3,4,5] b:1 //unshift:将参数添加到原数组开头,并返回数组的长度…

Java项目:平行志愿管理系统(java+Springboot+Maven+mybatis+Vue+Mysql)
源码获取:博客首页 "资源" 里下载! 一、项目简述本系统功能包括: 系统管理,招生计划,学生管理,录取结果,自动分配,调剂管理等等。 二、项目运行 环境配置: J…

冒泡 MS Azure 不便宜。。。
一直在等 MS Azure 中国开卖, 最近有消息说正式商用了。。。 看看去,ok 发现官方网站 很奇葩。没有购买的地方 说毛线 啊 卧槽 欺骗感情还是吊人胃口? 好看了一下VM的价格,卧槽真不便宜。 即使是 768 MB的也要 0.22RMB 小时。本来…

数据库的概念以及MYSQL的安装和卸载
一、数据库的基本概念: 1、什么是数据库? DataBase,简称DB。是用来存储和管理数据的仓库。 2、数据库的特点: 持久化存储数据的。其实数据库就是一个文件系统。方便存储和管理数据使用了统一的方式操作数据库——SQL 3、最热门…

对ARM异常(Exceptions)的理解
对ARM异常(Exceptions)的理解 1 .对 ARM 异常( Exceptions )的理解 所有的系统引导程序前面中会有一段类似的代码,如下: .globl _start ;系统复位位置 _s…

Java项目:花店商城系统(java+Springboot+Maven+mybatis+Vue+Mysql)
源码获取:博客首页 "资源" 里下载! 一、项目简述 本系统功能包括: 商品的分类展示,用户的注册登录,购物车,订单结算,购物车加减,后台商品管理,分类管理&#x…

简单又好看的按钮,扁平化按钮。
原文 http://blog.csdn.net/peijiangping1989/article/details/19333779主题 安卓开发今天分享一下流行的扁平化按钮。完全不需要用到图片哦。效果图如下: 里面有2个按钮都是一样的模式。只要修改的色值就可以。下面跟我来更新你的UI吧。 首先编写 button.xml 代码…

MahApps.Metro
ModernUI for WPF Mahapps.metro home Mahapps.metro Quick start Mahapps.metro controls转载于:https://www.cnblogs.com/xakml/p/3682173.html

用herl工具解决微信内链接或二维码可直接用外部浏览器打开
很多朋友问我怎么解决微信内点击链接或扫描二维码可以直接跳出微信在外部浏览器打开网页链接,其实这并不难,只要我们实现微信跳转功能即可。 下面给大家推荐 herl工具(http://www.nicejump.cn/) 使用步骤 1. 用浏览器打开我们的工…

shell之“/dev/null 21”
shell中可能经常能看到:>/dev/null 2>&1 命令的结果可以通过%>的形式来定义输出 分解这个组合:“>/dev/null 2>&1” 为五部分。 1:> 代表重定向到哪里,例如:echo "123" &g…
Java项目:角色权限后台脚手架系统(java+Springboot+Maven+myBaits-Plus+Vue+Element-UI+Mysql)
源码获取:博客首页 "资源" 里下载! Springboot框架myBaits-PlusMySQL实现的角色权限后台管理脚手架系统实战项目,实现的是所有系统最基础的后台管理功能,有了这个脚手架,以后开发别的项目就在这上面快速增加…

30+程序员,平时都忙些什么事情?平时都想些什么?以后有啥计划?
很多人都说,30岁以后了,写程序还有前途嘛?我有时候也迷茫,但是迷茫过后,总会给自己寻找方向,每个人都需要有个信念、没有信念,活着就没意思,无聊,觉得没奔头了。 废话少说…

用于制图、写电子邮件、创建条形码控件Aspose.Total
2019独角兽企业重金招聘Python工程师标准>>> Aspose.Total 提供了 Aspose 可以使用的任何组件,以及你每年订阅中发布的所有新组件。通过它,你能够有计划地操纵一些商业中最流行的文件格式:Word, Excel, PowerPoint, Project, PDF …

循环for语句 if语句
if语句: if(表达式){ 代码 }else if(表达式){ 代码 } for循环: for(var i0; i<10; i){ alert(1); (弹窗) } if语句: if(表达式){ 代码 }else if(表达式){ 代码 } for循环: for(var i0; i<10; i){ alert(1); (弹窗…

Linux中的粘滞位
Linux中的粘滞位 Sticky 位是一个访问权限标志位,可以用来标示文件和路径。 历史: 粘滞位是在1974年Unix的第5版中引入的,用来设置可执行文件。当可执行文件设置粘滞位之后,它能够指示操作系统在程序退出后,保留程序…

Java项目:实现权限管理系统(java+SpringBoot+MyBatis+AOP+LayUI+Mysql)
源码获取:博客首页 "资源" 里下载! springbootmybatis使用面向切面编程(AOP)实现的权限管理系统。 共五个模块,角色管理,菜单管理,实验室管理,学生管理,管理员…

阅读10、11、12章
第10章 假设用户交付给我们一个 任务,然后我们通过调研的出来的结果进行设计,最后的结果跟用户想象的不一样,这应该怎么做? 第11章 团队合作真的需要有那么繁琐的步骤(例如每日例会)吗? 第12章 …

SQL删除重复数据方法
原文:SQL删除重复数据方法例如: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b …

#pragma once与#ifndef
在C/C中,在使用预编译指令#include的时候,为了防止重复引用造成二义性的两种方法。 #ifndef 它不光可以保证同一份文件不会被包含两次,也能够保证不同文件完全相同的内容不会被包含两次。但,同样的,如果自定义的宏名不…

grep 在HP-UX下的递归查找
grep 在HP-UX下的递归查找Linux: man grep 可以看到 -r 选项-R, -r, --recursiveRead all files under each directory, recursively; this is equivalent to the -d recurse option.即:-r 选项可以查找指定目录下每个子目录下的所有文件eg:grep -r "28281&quo…

Java项目:实现个人博客系统(java+springboot+mybatis+redis+vue+elementui+Mysql)
源码获取:博客首页 "资源" 里下载! springbootmybatis前端vue,使用前后端分离架构实现的个人博客系统,共7个模块,首页,写博客,博客详情页,评论管理,文章分类&a…