一.登陆模块

前台提交账号和密码传到后台处理控制层

1.1 首先是控制器

@RequestMapping(value="/studentLogin", method=RequestMethod.POST)
public ModelAndView studentLogin(StudentInfo student, HttpServletRequest request) {
ModelAndView model = new ModelAndView();
StudentInfo loginStudent = studentInfoService.getStudentByAccountAndPwd(student.getStudentAccount());
if(loginStudent == null || !student.getStudentPwd().equals(loginStudent.getStudentPwd())){
model.setViewName("home/suc");
return model;
}
request.getSession().setAttribute("loginStudent", loginStudent);
System.out.println(request.getSession().getAttribute("loginStudent"));
model.setViewName("home/suc");
System.out.println("执行完毕");
return model;
}
}

1.2 在这里会调用服务层

StudentInfo loginStudent = studentInfoService.getStudentByAccountAndPwd(student.getStudentAccount());

1.3 服务层接口

public StudentInfo getStudentByAccountAndPwd(String studentAccount);

1.4 服务层实现

public StudentInfo getStudentByAccountAndPwd(String studentAccount) {
return studentInfoMapper.getStudentByAccountAndPwd(studentAccount);//调用dao接口
}

1.5 数据层接口

public StudentInfo getStudentByAccountAndPwd(String studentAccount);

1.6  数据层实现

<mapper namespace="com.caizhen.weknow.dao.StudentInfoMapper">
<!-- 定义resultMap -->
<resultMap type="com.caizhen.weknow.domain.StudentInfo" id="queryStudent">
<!-- 学号 -->
<id column="studentId" property="studentId"/>
<!-- 学生姓名 -->
<result column="studentName" property="studentName"/>
<!-- 学生账号 -->
<result column="studentAccount" property="studentAccount"/>
<!-- 学生账号密码 -->
<result column="studentPwd" property="studentPwd"/>
<!-- 班级 -->
<!-- 班级自身的属性与数据库字段的映射 -->
<association property="classInfo" javaType="com.caizhen.weknow.domain.ClassInfo">
<id column="classId" property="classId"/>
<result column="className" property="className"/>
</association>
<!-- 年级 -->
<!-- 年级自身的属性与数据库字段的映射 -->
<association property="grade" javaType="com.caizhen.weknow.domain.GradeInfo">
<id column="gradeId" property="gradeId"/>
<result column="gradeName" property="gradeName"/>
</association>
</resultMap>
<select id="getStudentByAccountAndPwd" parameterType="java.lang.String" resultMap="queryStudent">
SELECT a.*,b.className,c.gradeId,c.gradeName FROM StudentInfo a
INNER JOIN ClassInfo b ON a.classId=b.classId
INNER JOIN GradeInfo c ON b.gradeId=c.gradeId
WHERE studentAccount=#{studentAccount}
</select>
</mapper>

 二:考试中心模块

<li><a id="examCenter-link" target="home" style="cursor: pointer;" 
href="willexams?
classId=${sessionScope.loginStudent.classInfo.classId }&
gradeId=${sessionScope.loginStudent.grade.gradeId }&
studentId=${sessionScope.loginStudent.studentId }"
>考试中心</a></li>

向url:willexams传入三个参数:classId,gradeId,studentId

2.1进入控制器

@RequestMapping("/willexams")
public ModelAndView getStudentWillExam(
@RequestParam("classId") Integer classId,
@RequestParam("gradeId") Integer gradeId,
@RequestParam(value="studentId", required=false) Integer studentId) {
ModelAndView model = new ModelAndView();
model.setViewName("/home/examCenter");
//将classId和gradeId存入map集合中
Map<String, Object> map = new HashMap<String, Object>();
map.put("classId", classId);
map.put("gradeId", gradeId);
List<ExamPlanInfo> examPlans = examPlanInfoService.getStudentWillExam(map);
model.addObject("examPlans", examPlans);
model.addObject("gradeId", gradeId);
return model;
}

2.2 进入服务层接口

public List<ExamPlanInfo> getStudentWillExam(Map<String, Object> map);

2.3进入服务层实现层

public List<ExamPlanInfo> getStudentWillExam(Map<String, Object> map) {
return examPlanInfoMapper.getStudentWillExam(map);
}

2.4 进入数据协议层

public List<ExamPlanInfo> getStudentWillExam(Map<String, Object> map);

2.5 进入数据实现层

<mapper namespace="com.caizhen.weknow.dao.ExamPlanInfoMapper">

	<resultMap type="com.caizhen.weknow.domain.ExamPlanInfo" id="queryWillExam">
<id column="examPlanId" property="examPlanId"/>
<result column="beginTime" property="beginTime"/>
<!-- 科目 -->
<association property="course" javaType="com.caizhen.weknow.domain.CourseInfo">
<id column="courseId" property="courseId"/>
<result column="courseName" property="courseName"/>
</association>
<!-- 班级 -->
<association property="clazz" javaType="com.caizhen.weknow.domain.ClassInfo">
<id column="classId" property="classId"/>
</association>
<!-- 试卷 -->
<association property="examPaper" javaType="com.caizhen.weknow.domain.ExamPaperInfo">
<id column="examPaperId" property="examPaperId"/>
<result column="examPaperName" property="examPaperName"/>
<result column="subjectNum" property="subjectNum"/>
<result column="examPaperScore" property="examPaperScore"/>
<result column="examPaperEasy" property="examPaperEasy"/>
<result column="examPaperTime" property="examPaperTime"/>
</association>
</resultMap> <!-- 查询学生待考信息 -->
<!-- 考试安排表 examplaninfo a-->
<!-- 班级信息表 classinfo b-->
<!-- 年级表 gradeinfo c -->
<!-- 试卷表 exampaperinfo d -->
<!-- 课程表 courseinfo e -->
<!-- 需要的参数
1.a.* 考试安排表所有字段
2.d.examPaperName 试卷名称
3.d.subjectNum 试题号
4.d.examPaperScore 试卷分数
5.d.examPaperEasy 试卷难易度
6.d.examPaperTime 考试时长
5.e.coure.name 课程名称
-->
<select id="getStudentWillExam" parameterType="java.util.Map" resultMap="queryWillExam">
SELECT a.*,d.examPaperName,d.subjectNum,d.examPaperScore,d.examPaperEasy,d.examPaperTime,e.courseName FROM ExamPlanInfo a
INNER JOIN ClassInfo b ON a.classId=b.classId
INNER JOIN GradeInfo c ON b.gradeId=c.gradeId
INNER JOIN ExamPaperInfo d ON a.examPaperId=d.examPaperId
INNER JOIN CourseInfo e ON a.courseId=e.courseId
WHERE a.classId=#{classId} AND b.gradeId=#{gradeId}
</select>
</mapper>

2.6 定向到考试中心界面判断exPlans中的条数是否大于0

<c:when test="${fn:length(examPlans) > 0 }">

如果不是则输出页面

<c:otherwise>
<div class="jumbotron">
<h1>暂无待考信息</h1>
<p>请等待教师分配</p>
</div>
</c:otherwise>

 三:历史考试模块

1.前台

<!-- 考试历史 -->
<li><a id="mineCenter-link" target="home" style="cursor: pointer;" href="history/${sessionScope.loginStudent.studentId }" studentId="${sessionScope.loginStudent.studentId }">考试历史</a></li>

1.1 前台状态校验

<script type="text/javascript">
$(function() {
//考试中心状态判断
$("#examCenter-link, #mineCenter-link").click(function() {
//判断是否登录
var studetnId = $(this).attr("studentId");
//如果学生号为空
if(studetnId.trim() == "" || studetnId == null) {
zeroModal.show({
title: "提示",
content: "登录后才能查看",
width : '200px',
height : '130px',
overlay : false,
ok : true,
onClosed : function() {
location.reload();
}
});
return false;
}
});

2.后台

2.1 如果学生成功登陆后点击历史考试(控制层)

@Controller
public class ExamHistoryInfoHandler {
@Autowired
private ExamHistoryPaperService examHistoryPaperService;
@RequestMapping("/historys")
public ModelAndView examHistorys() {
List<ExamHistoryInfo> historys = examHistoryPaperService.getExamHistoryToTeacher();
ModelAndView model = new ModelAndView("admin/examHistorys");
model.addObject("historys", historys);
return model;
}
}

2.2 服务层

private ExamHistoryPaperService examHistoryPaperService;

服务层

public interface ExamHistoryPaperService {
//查询考试历史信息,针对前台学生查询
public List<ExamHistoryPaper> getExamHistoryToStudent(int studentId); public int isAddExamHistory(Map<String, Object> map); public int getHistoryInfoWithIds(Map<String, Object> map); public List<ExamHistoryInfo> getExamHistoryToTeacher();
}

2.3 服务实现层

@Service
public class ExamHistoryPaperServiceImpl implements ExamHistoryPaperService { @Autowired
private ExamHistoryPaperMapper examHistoryPaperMapper;
public List<ExamHistoryPaper> getExamHistoryToStudent(int studentId) {
return examHistoryPaperMapper.getExamHistoryToStudent(studentId);
}
public int isAddExamHistory(Map<String, Object> map) {
return examHistoryPaperMapper.isAddExamHistory(map);
}
public int getHistoryInfoWithIds(Map<String, Object> map) {
return examHistoryPaperMapper.getHistoryInfoWithIds(map);
}
public List<ExamHistoryInfo> getExamHistoryToTeacher() {
return examHistoryPaperMapper.getExamHistoryToTeacher();
}
}

2.4 数据接口层

public interface ExamHistoryPaperMapper {

	//查询考试历史信息,针对前台学生查询
public List<ExamHistoryPaper> getExamHistoryToStudent(int studentId); public int isAddExamHistory(Map<String, Object> map); public int getHistoryInfoWithIds(Map<String, Object> map); //查询考试历史信息,针对后台教师查询
public List<ExamHistoryInfo> getExamHistoryToTeacher();
}

2.5 数据实现层

<mapper namespace="com.caizhen.weknow.dao.ExamHistoryPaperMapper">

	<resultMap type="com.caizhen.weknow.domain.ExamHistoryInfo" id="queryExamHistoryToStudentResultMap">
<id column="historyId" property="historyId"/>
<result column="examScore" property="examScore"/>
<association property="examPaper" javaType="com.caizhen.weknow.domain.ExamPaperInfo">
<id column="examPaperId" property="examPaperId"/>
<result column="examPaperName" property="examPaperName"/>
<result column="examPaperScore" property="examPaperScore"/>
<result column="subjectNum" property="subjectNum"/>
</association>
</resultMap> <!-- 查询考试历史信息,针对前台学生查询 -->
<select id="getExamHistoryToStudent" parameterType="int" resultType="ExamHistoryPaper">
SELECT
a.historyId,a.examScore,b.examPaperId,b.examPaperName,b.examPaperScore,b.subjectNum,c.beginTime
FROM ExamHistoryInfo a
LEFT JOIN examPaperInfo b ON a.examPaperId=b.exampaperId
LEFT JOIN examPlanInfo c ON b.examPaperId=c.examPaperId
WHERE studentId=#{studentId}
</select> <!-- 新增历史记录 -->
<insert id="isAddExamHistory" parameterType="java.util.Map">
INSERT INTO ExamHistoryInfo VALUES(NULL, #{studentId}, #{examPaperId}, #{examScore});
</insert> <select id="getHistoryInfoWithIds" parameterType="java.util.Map" resultType="int">
SELECT COUNT(*) FROM ExamHistoryInfo WHERE studentId=#{studentId} AND examPaperId=#{examPaperId}
</select> <resultMap type="com.caizhen.weknow.domain.ExamHistoryInfo" id="queryExamHistoryToTeacherResultMap">
<id column="historyId" property="historyId"/>
<result column="examScore" property="examScore"/>
<association property="examPaper" javaType="com.caizhen.weknow.domain.ExamPaperInfo">
<id column="examPaperId" property="examPaperId"/>
<result column="examPaperName" property="examPaperName"/>
<result column="examPaperScore" property="examPaperScore"/>
<result column="subjectNum" property="subjectNum"/>
</association>
<association property="student" javaType="com.caizhen.weknow.domain.StudentInfo">
<id column="studentId" property="studentId"/>
<result column="studentName" property="studentName"/>
</association>
</resultMap>
<!-- 查询考试历史信息,针对后台教师查询 -->
<select id="getExamHistoryToTeacher" resultMap="queryExamHistoryToTeacherResultMap">
SELECT
a.historyId,a.examScore,b.examPaperId,b.examPaperName,b.examPaperScore,b.subjectNum,d.studentId,d.studentName
FROM ExamHistoryInfo a
INNER JOIN examPaperInfo b ON a.examPaperId=b.exampaperId
LEFT JOIN StudentInfo d ON a.studentId=d.studentId;
</select>
</mapper>

ssm+mysql+jsp打造在线考试系统WeKnow-学生端的更多相关文章

  1. 基于java开发jsp+ssm+mysql实现的在线考试系统 源码下载

    实现的关于在线考试的功能有:用户前台:用户注册登录.查看考试信息.进行考试.查看考试成绩.查看历史考试记录.回顾已考试卷.修改密码.修改个人信息等,后台管理功能(脚手架功能不在这里列出),科目专业管理 ...

  2. 基于JSP的在线考试系统-JavaWeb项目-有源码

    开发工具:Myeclipse/Eclipse + MySQL + Tomcat 系统简介: 网络考试系统主要用于实现高校在线考试,基本功能包括:自动组卷.试卷发布.试卷批阅.试卷成绩统计等.本系统结构 ...

  3. 基于Web在线考试系统的设计与实现

    这是一个课程设计的文档,源码及文档数据库我都修改过了,貌似这里复制过来的时候图片不能贴出,下载地址:http://download.csdn.net/detail/sdksdk0/9361973   ...

  4. 基于B/S架构的在线考试系统的设计与实现

    前言 这个是我的Web课程设计,用到的主要是JSP技术并使用了大量JSTL标签,所有代码已经上传到了我的Github仓库里,地址:https://github.com/quanbisen/online ...

  5. JavaWeb项目开发案例精粹-第3章在线考试系统-007View层

    0.login.jsp <%@ page language="java" import="java.util.*" pageEncoding=" ...

  6. Java在线考试系统(含源码)

    本文demo下载和视频教学观看地址:http://www.wisdomdd.cn/Wisdom/resource/articleDetail.htm?resourceId=1076 本实例介绍了在线考 ...

  7. 基于Django的在线考试系统

    概述 基于Django的在线考试系统,适配电脑端,可以实现出题,答题,排行榜,倒计时等等等功能 详细 代码下载:http://www.demodashi.com/demo/13923.html 项目目 ...

  8. 基于ssh框架的在线考试系统开发的质量属性

    我做的系统是基于ssh框架的在线考试系统.在线考试系统有以下几点特性:(1)系统响应时间需要非常快,可以迅速的出题,答题.(2)系统的负载量也需要非常大,可以支持多人在线考试(3)还有系统的安全性也需 ...

  9. WSB功能分解(在线考试系统)

    对在线考试系统进行WSB功能分解至三级子功能,并且预估每个子功能所需时间. 一级功能 二级功能 三级功能 预估花费时间(小时) 考试管理员功能模块 培训计划 查询 1.5 重置 1 新增计划 1.5 ...

随机推荐

  1. 基于hadoop_yarn的资源隔离配置

    目录 yarn的基本概念 scheduler 集群整体的资源定义 fair scheduler简介 配置demo 队列的资源限制 基于具体资源限制 基于权重资源限制 队列运行状态限制 基于用户和分组限 ...

  2. c语言循环位移(数字,字符串)

    C语言中没有提供循环移位的操作符,但可以通过简洁的方式实现循环移位 设一个操作数x有s位则循环左移n位的操作为: (x << n) | (x >> (s - n)); 同理右移 ...

  3. Linux 软连接与硬连接 区别

    先说结论 软连接相当于快捷方式,访问软连接会被替换为其指向的绝对路径,如果其指向的文件被删除,则无法访问. 硬连接相当于指针,与它指向的文件都指向相同的inode,当其指向的文件被删除,inode由于 ...

  4. 分布式事务(七)之Seata简介

    在前面的文章中,我们介绍了分布式事务的概念以及一些解决方案.fenSeata是一款开源的分布式事务解决方案,致力于提供高性能和简单易用的分布式事务服务.Seata将为用户提供了AT.TCC.SAGA和 ...

  5. 交叉编译环境的linaro-gdb可以用了,结果打开core文件,显示堆栈都是??

    交叉编译环境的linaro-gdb可以用了,结果打开core文件,显示堆栈都是?? aarch64-linux-gun-gdb ./test core warning: /lib/libpthread ...

  6. 【Cloud Computing】Hadoop环境安装、基本命令及MapReduce字数统计程序

    [Cloud Computing]Hadoop环境安装.基本命令及MapReduce字数统计程序 1.虚拟机准备 1.1 模板机器配置 1.1.1 主机配置 IP地址:在学校校园网Wifi下连接下 V ...

  7. java 代理模式实现代码

    目录 1.静态代理 2.动态代理 1.静态代理 接口类AdminService.java接口 public interface AdminService { void update(); Object ...

  8. Codeforces 1188E - Problem from Red Panda(找性质+组合数学)

    Codeforces 题面传送门 & 洛谷题面传送门 咦,题解搬运人竟是我? 一道很毒的计数题. 先转化下题意,每一次操作我们可以视作选择一种颜色并将其出现次数 \(+k\),之后将所有颜色的 ...

  9. 洛谷 P5853 - [USACO19DEC]Tree Depth P(生成函数+背包)

    洛谷题面传送门 神仙题. 首先考虑一个点的深度是什么,注意到对于笛卡尔树而言直接从序列的角度计算一个点的深度是不容易的,因为这样会牵扯到序列中多个元素,需要 fixed 的东西太多,计算起来太复杂了. ...

  10. 【百奥云GS专栏】全基因组选择之工具篇

    目录 1. 免费开源包/库 1.1 R包 1.2 Python库 2. 成熟软件 3. WEB/GUI工具 前面我们已经介绍了基因组选择的各类模型,今天主要来了解一下做GS有哪些可用的软件和工具.基因 ...