使用SSM+JSP实现一个教务管理系统
Posted 编程指南针
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用SSM+JSP实现一个教务管理系统相关的知识,希望对你有一定的参考价值。
最近为客户开发了一套学校用教务管理系统,主要实现学生、课程、老师、选课等相关的信息化管理功能,今天拿出来给大家介绍一下:
系统编号:BS-GX-020
后台技术:Spring+Springmvvc+mybatis+shiro
前端技术:Bootstrap+jquery+ajax
页面开发:JSP
开发工具:IDEA 或 Eclipse
数据库:mysql5
应用服务器:tomcat8
JAVA版本:jdk1.8
说明:本系统基于SSM框架开发而成,系统功能完整,界面简洁大方,运行无误,适合做毕业设计使用。
系统分三个角色:
1,管理员角色:可以管理课程,管理教师,管理学生,个人信息管理等
2,教师角色:可以管理选课成绩,对选修本人的课程进行打分,个人信息管理等
3,学生角色:可以进行选课,退课,查看选课信息,选课成绩,个人信息管理等
系统功能演示如下:
管理员登陆:
课程管理:
添加课程:分配老师
学生管理:
老师管理:
重置其它账户密码:
密码修改:
教师登陆:
为选课的学生打分
学生登陆:
己选课程:显示己选未结课(未打分)
己修课程:显示己选并结课(己打分)
以上是基于SSM教务管理系统的部分功能展示,本项目比较适合JAVA语言方面 的毕业设计系统使用。
部分项目实现代码:
package com.system.service.impl;
import com.system.mapper.CollegeMapper;
import com.system.po.College;
import com.system.po.CollegeExample;
import com.system.service.CollegeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;
/**
* 院系管理
*/
@Service
public class CollegeServiceImpl implements CollegeService@Autowired
private CollegeMapper collegeMapper;//查询所有院系
public List<College> finAll() throws Exception
CollegeExample collegeExample = new CollegeExample();
CollegeExample.Criteria criteria = collegeExample.createCriteria();criteria.andCollegeidIsNotNull();
return collegeMapper.selectByExample(collegeExample);
//添加院系
public void addCollege(College college)
collegeMapper.insert(college);
//查询单个院系
public College findCollegeById(Integer id)
return collegeMapper.selectByPrimaryKey(id);
//更新院系
public void updateCollege(College college)
collegeMapper.updateByPrimaryKey(college);
package com.system.service.impl;
import com.system.mapper.CollegeMapper;
import com.system.mapper.CourseMapper;
import com.system.mapper.CourseMapperCustom;
import com.system.mapper.SelectedcourseMapper;
import com.system.po.*;
import com.system.service.CourseService;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.ArrayList;
import java.util.List;/**
课程管理业务实现
*/
@Service
public class CourseServiceImpl implements CourseService@Autowired
private CourseMapper courseMapper;@Autowired
private CourseMapperCustom courseMapperCustom;@Autowired
private CollegeMapper collegeMapper;@Autowired
private SelectedcourseMapper selectedcourseMapper;public void upadteById(Integer id, CourseCustom courseCustom) throws Exception
courseMapper.updateByPrimaryKey(courseCustom);
public Boolean removeById(Integer id) throws Exception
//自定义查询条件
SelectedcourseExample example = new SelectedcourseExample();
SelectedcourseExample.Criteria criteria = example.createCriteria();
criteria.andCourseidEqualTo(id);
List<Selectedcourse> list = selectedcourseMapper.selectByExample(example);if (list.size() == 0)
courseMapper.deleteByPrimaryKey(id);
return true;
return false;
public List<CourseCustom> findByPaging(Integer toPageNo) throws Exception
PagingVO pagingVO = new PagingVO();
pagingVO.setToPageNo(toPageNo);List<CourseCustom> list = courseMapperCustom.findByPaging(pagingVO);
return list;
public Boolean save(CourseCustom couseCustom) throws Exception
Course course = courseMapper.selectByPrimaryKey(couseCustom.getCourseid());
if (course == null)
courseMapper.insert(couseCustom);
return true;
return false;
public int getCountCouse() throws Exception
//自定义查询对象
CourseExample courseExample = new CourseExample();
//通过criteria构造查询条件
CourseExample.Criteria criteria = courseExample.createCriteria();
criteria.andCoursenameIsNotNull();return courseMapper.countByExample(courseExample);
public CourseCustom findById(Integer id) throws Exception
Course course = courseMapper.selectByPrimaryKey(id);
CourseCustom courseCustom = null;
if (course != null)
courseCustom = new CourseCustom();
BeanUtils.copyProperties(courseCustom, course);
return courseCustom;
public List<CourseCustom> findByName(String name) throws Exception
CourseExample courseExample = new CourseExample();
//自定义查询条件
CourseExample.Criteria criteria = courseExample.createCriteria();criteria.andCoursenameLike("%" + name + "%");
List<Course> list = courseMapper.selectByExample(courseExample);
List<CourseCustom> courseCustomList = null;
if (list != null)
courseCustomList = new ArrayList<CourseCustom>();
for (Course c : list)
CourseCustom courseCustom = new CourseCustom();
//类拷贝
org.springframework.beans.BeanUtils.copyProperties(c, courseCustom);
//获取课程名
College college = collegeMapper.selectByPrimaryKey(c.getCollegeid());
courseCustom.setcollegeName(college.getCollegename());courseCustomList.add(courseCustom);
return courseCustomList;
public List<CourseCustom> findByTeacherID(Integer id) throws Exception
CourseExample courseExample = new CourseExample();
//自定义查询条件
CourseExample.Criteria criteria = courseExample.createCriteria();
//根据教师id查课程
criteria.andTeacheridEqualTo(id);List<Course> list = courseMapper.selectByExample(courseExample);
List<CourseCustom> courseCustomList = null;if (list.size() > 0)
courseCustomList = new ArrayList<CourseCustom>();
for (Course c : list)
CourseCustom courseCustom = new CourseCustom();
//类拷贝
BeanUtils.copyProperties(courseCustom, c);
//获取课程名
College college = collegeMapper.selectByPrimaryKey(c.getCollegeid());
courseCustom.setcollegeName(college.getCollegename());courseCustomList.add(courseCustom);
return courseCustomList;
package com.system.service.impl;
import com.system.mapper.CollegeMapper;
import com.system.mapper.StudentMapper;
import com.system.mapper.StudentMapperCustom;
import com.system.po.*;
import com.system.service.StudentService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.ArrayList;
import java.util.List;/**
学生管理业务实现
*/
@Service
public class StudentServiceImpl implements StudentService//使用spring 自动注入
@Autowired
private StudentMapperCustom studentMapperCustom;@Autowired
private StudentMapper studentMapper;@Autowired
private CollegeMapper collegeMapper;public void updataById(Integer id, StudentCustom studentCustom) throws Exception
studentMapper.updateByPrimaryKey(studentCustom);
public void removeById(Integer id) throws Exception
studentMapper.deleteByPrimaryKey(id);
public List<StudentCustom> findByPaging(Integer toPageNo) throws Exception
PagingVO pagingVO = new PagingVO();
pagingVO.setToPageNo(toPageNo);List<StudentCustom> list = studentMapperCustom.findByPaging(pagingVO);
return list;
public Boolean save(StudentCustom studentCustoms) throws Exception
Student stu = studentMapper.selectByPrimaryKey(studentCustoms.getUserid());
if (stu == null)
studentMapper.insert(studentCustoms);
return true;
return false;
//返回学生总数
public int getCountStudent() throws Exception
//自定义查询对象
StudentExample studentExample = new StudentExample();
//通过criteria构造查询条件
StudentExample.Criteria criteria = studentExample.createCriteria();
criteria.andUseridIsNotNull();return studentMapper.countByExample(studentExample);
public StudentCustom findById(Integer id) throws Exception
Student student = studentMapper.selectByPrimaryKey(id);
StudentCustom studentCustom = null;
if (student != null)
studentCustom = new StudentCustom();
//类拷贝
BeanUtils.copyProperties(student, studentCustom);
return studentCustom;
//模糊查询
public List<StudentCustom> findByName(String name) throws ExceptionStudentExample studentExample = new StudentExample();
//自定义查询条件
StudentExample.Criteria criteria = studentExample.createCriteria();criteria.andUsernameLike("%" + name + "%");
List<Student> list = studentMapper.selectByExample(studentExample);
List<StudentCustom> studentCustomList = null;
if (list != null)
studentCustomList = new ArrayList<StudentCustom>();
for (Student s : list)
StudentCustom studentCustom = new StudentCustom();
//类拷贝
BeanUtils.copyProperties(s, studentCustom);
//获取课程名
College college = collegeMapper.selectByPrimaryKey(s.getCollegeid());
studentCustom.setcollegeName(college.getCollegename());studentCustomList.add(studentCustom);
return studentCustomList;
public StudentCustom findStudentAndSelectCourseListByName(String name) throws Exception
StudentCustom studentCustom = studentMapperCustom.findStudentAndSelectCourseListById(Integer.parseInt(name));
List<SelectedCourseCustom> list = studentCustom.getSelectedCourseList();
// 判断该课程是否修完
for (SelectedCourseCustom s : list)
if (s.getMark() != null)
s.setOver(true);
return studentCustom;
package com.system.service.impl;
import com.system.exception.CustomException;
import com.system.mapper.CollegeMapper;
import com.system.mapper.CourseMapper;
import com.system.mapper.TeacherMapper;
import com.system.mapper.TeacherMapperCustom;
import com.system.po.*;
import com.system.service.TeacherService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.ArrayList;
import java.util.List;
/**
教师管理业务实现
*/
@Service
public class TeacherServiceImpl implements TeacherService@Autowired
private TeacherMapper teacherMapper;@Autowired
private TeacherMapperCustom teacherMapperCustom;@Autowired
private CollegeMapper collegeMapper;@Autowired
private CourseMapper courseMapper;public void updateById(Integer id, TeacherCustom teacherCustom) throws Exception
teacherMapper.updateByPrimaryKey(teacherCustom);
public void removeById(Integer id) throws Exception
CourseExample courseExample = new CourseExample();CourseExample.Criteria criteria = courseExample.createCriteria();
criteria.andTeacheridEqualTo(id);
List<Course> list = courseMapper.selectByExample(courseExample);if (list.size() != 0)
throw new CustomException("请先删除该名老师所教授的课程");
teacherMapper.deleteByPrimaryKey(id);
public List<TeacherCustom> findByPaging(Integer toPageNo) throws Exception
PagingVO pagingVO = new PagingVO();
pagingVO.setToPageNo(toPageNo);List<TeacherCustom> list = teacherMapperCustom.findByPaging(pagingVO);
return list;
public Boolean save(TeacherCustom teacherCustom) throws Exception
Teacher tea = teacherMapper.selectByPrimaryKey(teacherCustom.getUserid());
if (tea == null)
teacherMapper.insert(teacherCustom);
return true;
return false;
public int getCountTeacher() throws Exception
//自定义查询对象
TeacherExample teacherExample = new TeacherExample();
//通过criteria构造查询条件
TeacherExample.Criteria criteria = teacherExample.createCriteria();
criteria.andUseridIsNotNull();return teacherMapper.countByExample(teacherExample);
public TeacherCustom findById(Integer id) throws Exception
Teacher teacher = teacherMapper.selectByPrimaryKey(id);
TeacherCustom teacherCustom = null;
if (teacher != null)
teacherCustom = new TeacherCustom();
BeanUtils.copyProperties(teacher, teacherCustom);
return teacherCustom;
public List<TeacherCustom> findByName(String name) throws Exception
TeacherExample teacherExample = new TeacherExample();
//自定义查询条件
TeacherExample.Criteria criteria = teacherExample.createCriteria();criteria.andUsernameLike("%" + name + "%");
List<Teacher> list = teacherMapper.selectByExample(teacherExample);
List<TeacherCustom> teacherCustomList = null;
if (list != null)
teacherCustomList = new ArrayList<TeacherCustom>();
for (Teacher t : list)
TeacherCustom teacherCustom = new TeacherCustom();
//类拷贝
BeanUtils.copyProperties(t, teacherCustom);
//获取课程名
College college = collegeMapper.selectByPrimaryKey(t.getCollegeid());
teacherCustom.setcollegeName(college.getCollegename());teacherCustomList.add(teacherCustom);
return teacherCustomList;
public List<TeacherCustom> findAll() throws Exception
TeacherExample teacherExample = new TeacherExample();
TeacherExample.Criteria criteria = teacherExample.createCriteria();criteria.andUsernameIsNotNull();
List<Teacher> list = teacherMapper.selectByExample(teacherExample);
List<TeacherCustom> teacherCustomsList = null;
if (list != null)
teacherCustomsList = new ArrayList<TeacherCustom>();
for (Teacher t: list)
TeacherCustom teacherCustom = new TeacherCustom();
BeanUtils.copyProperties(t, teacherCustom);
teacherCustomsList.add(teacherCustom);
return teacherCustomsList;
以上是关于使用SSM+JSP实现一个教务管理系统的主要内容,如果未能解决你的问题,请参考以下文章
java基于ssm的学校教务管理系统的设计与实现论文-计算机毕业设计
IDEA+Java+SSM+Mysql+Bootstrap+Maven实现学校教务管理系统