项目介绍
该项目分为学生、教师两个角色,主要功能如下:
- 学生模块
1) 我的课程:学生可在此页面自由选课
2) 我的作业:可查看选择的课程已发布的作业及完成情况,并可选择完成作业或查看详情
- 教师模块
1) 学生管理:
I. 查询学生:可根据学生信息搜索学生,可进行修改删除操作,可进行全选批量删除和导出excel表格,可根据查询到的数据进行分页,输入页码进行跳转操作
II. 添加学生:可进行单个添加学生或excel表格导入学生
2) 教师管理:
I. 查询教师:可根据教师信息搜索教师,可进行修改删除操作,可进行全选批量删除和导出excel表格,可根据查询到的数据进行分页,输入页码进行跳转操作
II. 添加教师:可进行单个添加学生或excel表格导入教师
3) 班级管理:
I. 查询班级:可查看所有班级,进行删除修改等操作
II. 添加班级:可进行添加班级操作
4) 课程管理:
I. 查询课程:可查看所有课程,进行修改删除操作
II. 添加班级:可进行添加课程操作
5) 作业管理:
I. 查看作业完成情况:可查看每门科目项目学生作业的完成情况,可根据起止时间和课程名称进行搜索。
II. 添加作业:选择一门课程搜索题库,在题库中选择题目后进行作业发布操作
III. 编辑题库:可对题库进行增删改操作
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:是
技术栈
- 后端:SpringBoot+Mybatis+Thymeleaf模板引擎
- 前端:HTML+CSS+JavaScript+BootStrap
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
- 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
- 将项目中application.properties配置文件中的数据库配置改为自己的配置;
- 运行项目,输入localhost:8080/ 登录
教师账号:js 密码:123456
学生账号:wangyi 密码:123456
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
model.addObject("grades", grades);
return model;
}
}
老师管理控制层:
/**
*
* <p>
* Title: TeacherInfoHandler
* </p>
* <p>
* Description: 教师
* </p>
*/
@Controller
@SuppressWarnings("all")
public class TeacherInfoHandler {
@Autowired
private TeacherInfoService teacherInfoService;
private Logger logger = Logger.getLogger(TeacherInfoHandler.class);
/**
if (isUpdate != null) {
logger.info("修改学生 " + student + " 的信息");
int row = studentInfoService.isUpdateStudent(student);
} else {
logger.info("添加学生 " + student + " 的信息");
int row = studentInfoService.isAddStudent(student);
}
return "redirect:/students";
}
/**
* 删除学生
* @param studentId
* @return
*/
@RequestMapping(value = "/student/{studentId}", method = RequestMethod.DELETE)
public String isDelTeacher(@PathVariable("studentId") Integer studentId) {
logger.info("删除学生 " + studentId);
int row = studentInfoService.isDelStudent(studentId);
return "redirect:/students";
}
/**
* 预添加学生
* @return
*/
@RequestMapping("/preAddStudent")
public ModelAndView preAddStudent() {
*/
@RequestMapping("/validateLoginStudent")
public void validateLoginStudent(@RequestParam("studentAccount") String studentAccount,
HttpServletResponse response) throws IOException {
logger.info("学生账户 "+studentAccount+",尝试登录考试");
//获取需要登录的学生对象
StudentInfo student = studentInfoService.getStudentByAccountAndPwd(studentAccount);
if (student == null) {
logger.error("登录学生账户 "+studentAccount+" 不存在");
response.getWriter().print("n");
} else {
logger.error("登录学生账户 "+studentAccount+" 存在");
response.getWriter().print(student.getStudentPwd());
}
}
/**
* 学生登录考试
* @param student 登录学生
* @param request
* @return
// 计算总页数
int pageTotal = 1;
if (teacherTotal % pageShow == 0)
pageTotal = teacherTotal / pageShow;
else
pageTotal = teacherTotal / pageShow + 1;
model.addObject("pageTotal", pageTotal);
model.addObject("pageNow", startPage);
return model;
}
/**
* 预修改教师
*
* @param teacherId
* @return
*/
@RequestMapping(value = "/teacher/{teacherId}", method = RequestMethod.GET)
public ModelAndView preUpdateTeacher(@PathVariable("teacherId") Integer teacherId) {
logger.info("预修改教师处理");
ModelAndView model = new ModelAndView();
// 获取要修改教师
TeacherInfo teacher = teacherInfoService.getTeacherById(teacherId);
model.setViewName("/admin/teacher/teacheredit");
model.addObject("teacher", teacher);
return model;
}
* @param teacherAccount
* @param response
* @throws Exception
*/
@RequestMapping(value = "/validateTeacher", method = RequestMethod.POST)
public void queryTeacherExists(@RequestParam(value = "account") String teacherAccount, HttpServletResponse response)
throws Exception {
logger.info("获取教师 " + teacherAccount + " 的信息");
TeacherInfo teacherInfo = null;
teacherInfo = teacherInfoService.getTeacherByAccount(teacherAccount);
// 教师账户不存在
if (teacherInfo == null) {
response.getWriter().print("1");
} else {
response.getWriter().print(teacherInfo.getTeacherPwd());
}
}
/**
* 教师登录
*
* @param teacherAccount
* @param request
* @return
*/
@RequestMapping(value = "/teacherlogin", method = RequestMethod.POST)
TeacherInfo teacher = teacherInfoService.getTeacherById(teacherId);
teachers.add(teacher);
model.addObject("teachers", teachers);
model.setViewName("/admin/teacher/teachers");
return model;
}
}
/**
* 教师退出登录
*
* @throws IOException
*/
@RequestMapping("/exitTeacher")
public void exitTeacher(HttpSession session, HttpServletResponse response) throws IOException {
session.removeAttribute("loginTeacher");
@SuppressWarnings("all")
public class TeacherInfoHandler {
@Autowired
private TeacherInfoService teacherInfoService;
private Logger logger = Logger.getLogger(TeacherInfoHandler.class);
/**
* 获取 验证教师信息
*
* @param teacherAccount
* @param response
* @throws Exception
*/
@RequestMapping(value = "/validateTeacher", method = RequestMethod.POST)
* @param classId 班级编号
* @param examPaperId 试卷编号
* @param studentId 考生编号
* @param examTime 考试时间
* @param beginTime 考试开始时间
* @param gradeId 系部编号
* @param session
* @return
*/
@RequestMapping("/begin")
public ModelAndView beginExam(
@RequestParam("classId") Integer classId,
@RequestParam("examPaperId") Integer examPaperId,
@RequestParam(value="studentId", required=false) Integer studentId,
@RequestParam("examTime") Integer examTime,
@RequestParam("beginTime") String beginTime,
@RequestParam("gradeId") Integer gradeId,
HttpSession session) {
ModelAndView model = new ModelAndView();
* 分科情况
* @return
*/
@RequestMapping("/courses")
public ModelAndView getCourses(@RequestParam(value = "gradeId", required = false) Integer gradeId,
@RequestParam(value = "division", required = false) Integer division) {
ModelAndView model = new ModelAndView();
model.setViewName("/admin/course/courses");
CourseInfo course = new CourseInfo();
if (gradeId != null)
course.getGrade().setGradeId(gradeId);
if (division != null)
course.setDivision(division);
List<CourseInfo> courses = courseInfoService.getCourses(course);
public void queryTeacherExists(@RequestParam(value = "account") String teacherAccount, HttpServletResponse response)
throws Exception {
logger.info("获取教师 " + teacherAccount + " 的信息");
TeacherInfo teacherInfo = null;
teacherInfo = teacherInfoService.getTeacherByAccount(teacherAccount);
// 教师账户不存在
if (teacherInfo == null) {
response.getWriter().print("1");
} else {
response.getWriter().print(teacherInfo.getTeacherPwd());
}
}
/**
* 教师登录
*
* @param teacherAccount
* @param request
* @return
*/
@RequestMapping(value = "/teacherlogin", method = RequestMethod.POST)
public String teacherLogin(@RequestParam("teacherAccount") String teacherAccount, HttpServletRequest request) {
if (teacherAccount == null || "".equals(teacherAccount)) {