今天给大家介绍一个基于SSM框架的教务管理系统,该系统适合编程学习也可以当作课设、毕设等的参考,话不多说,上图:
用到的技术
后端:JAVA语言,SSM框架,MySql数据库
前端:JSP,BootStrap框架
SSM(Spring+SpringMVC+MyBatis)框架集由Spring、MyBatis两个开源框架整合而成(SpringMVC是Spring中的部分内容),常作为数据源较简单的web项目的框架。
Bootstrap是美国Twitter公司的设计师MarkOtto和JacobThornton合作基于HTML、CSS、JavaScript开发的简洁、直观、强悍的前端开发框架,使得 Web 开发更加快捷。Bootstrap提供了优雅的HTML和CSS规范,它即是由动态CSS语言Less写成。Bootstrap一经推出后颇受欢迎,一直是GitHub上的热门开源项目,包括NASA的MSNBC(微软全国广播公司)的Breaking News都使用了该项目。国内一些移动开发者较为熟悉的框架,如WeX5前端开源框架等,也是基于Bootstrap源码进行性能优化而来。
实现的功能
管理员、教师、学生三种角色,学生管理、教师管理、课程管理、成绩管理、账号管理等;
部分代码展示
// 学生信息显示
@RequestMapping("/showStudent")
public String showStudent(Model model, Integer page) throws Exception {
List<StudentCustom> list = null;
//页码对象
PagingVO pagingVO = new PagingVO();
//设置总页数
pagingVO.setTotalCount(studentService.getCountStudent());
if (page == null || page == 0) {
pagingVO.setToPageNo(1);
list = studentService.findByPaging(1);
} else {
pagingVO.setToPageNo(page);
list = studentService.findByPaging(page);
}
model.addAttribute("studentList", list);
model.addAttribute("pagingVO", pagingVO);
return "admin/showStudent";
}
// 添加学生信息页面显示
@RequestMapping(value = "/addStudent", method = {RequestMethod.GET})
public String addStudentUI(Model model) throws Exception {
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
return "admin/addStudent";
}
// 添加学生信息操作
@RequestMapping(value = "/addStudent", method = {RequestMethod.POST})
public String addStudent(StudentCustom studentCustom, Model model) throws Exception {
Boolean result = studentService.save(studentCustom);
if (!result) {
model.addAttribute("message", "学号重复");
return "error";
}
//添加成功后,也添加到登录表
Userlogin userlogin = new Userlogin();
userlogin.setUsername(studentCustom.getUserid().toString());
userlogin.setPassword("123");
userlogin.setRole(2);
userloginService.save(userlogin);
//重定向
return "redirect:/admin/showStudent";
}
// 修改学生信息页面显示
@RequestMapping(value = "/editStudent", method = {RequestMethod.GET})
public String editStudentUI(Integer id, Model model) throws Exception {
if (id == null) {
//加入没有带学生id就进来的话就返回学生显示页面
return "redirect:/admin/showStudent";
}
StudentCustom studentCustom = studentService.findById(id);
if (studentCustom == null) {
throw new CustomException("未找到该名学生");
}
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
model.addAttribute("student", studentCustom);
return "admin/editStudent";
}
// 修改学生信息处理
@RequestMapping(value = "/editStudent", method = {RequestMethod.POST})
public String editStudent(StudentCustom studentCustom) throws Exception {
studentService.updataById(studentCustom.getUserid(), studentCustom);
//重定向
return "redirect:/admin/showStudent";
}
// 删除学生
@RequestMapping(value = "/removeStudent", method = {RequestMethod.GET} )
private String removeStudent(Integer id) throws Exception {
if (id == null) {
//加入没有带学生id就进来的话就返回学生显示页面
return "admin/showStudent";
}
studentService.removeById(id);
userloginService.removeByName(id.toString());
return "redirect:/admin/showStudent";
}
演示视频
基于SSM框架的教务管理系统