一、系统介绍
1.开发环境
开发工具:IDEA 2020.2
JDK版本:jdk1.8
MySQL版本:8.0.22
2.技术概要
后端:使用SpringMVC+Spring+MyBaitis进行开发,使用过滤器拦截器来验证用户是否登录以及通过MVC模式分层
前端:使用Layuimini作为前端框架进行开发,通过Json进行前后端数据传输,jsp进行展示页面
数据库:使用JDBC连接数据库
3.设计概要
4.功能模块设计
a.登录模块
自定义3类用户(管理员、老师、学生)登陆学生管理系统,并设置登录权限;
实现登录码验证操作;
b.管理员模块
专业管理:对专业名称以及所属院系进行增删查改;
班级管理:对班级名称以及所属专业进行增删查改;
学生管理:对学生信息进行增删查改;
老师管理:对老师信息进行增删查改;
课程管理:对课程进行增删查改;
开课管理:对对应班级对应学期的课程进行开课操作,使得学生可以自主选课;
用户管理:对用户信息进行增删查改;
c.老师模块
成绩管理:显示自己任教的科目并对可以对所教科目的学生进行成绩评分;
学生查询:查询学生信息
d.学生模块
选课管理:学生通过学校开设课程进行选择并保存,实现学生自主选课;
成绩查询:显示学生所选课程所得的成绩;
二、系统展示
图1 系统登录界面
图2 管理员模块界面
图3 专业管理模块
图4 班级管理模块
图5 学生管理模块
图6 老师管理模块
图7 课程管理模块
图8 开课管理模块
图9 用户管理模块
图10 教师模块界面
图11 成绩管理模块
图12 评分操作
图13 学生查询模块
图14 学生管理模块
图15 选课管理模块
图16 成绩查询模块
三、部分代码
Student.java
package com.xiaoqiang.entity;
import com.xiaoqiang.utils.Entity;
import java.util.Date;
public class Student extends Entity {
private String addr;
private String gender;
private Date birthday;
private String cardNo;
private Integer clazzId;
private Integer id;
private Date joinDate;
private String phone;
private String pname;
private String status;
private String stuName;
private String stuNo;
private String stuPwd;
private Integer subjectId;
private String telephone;
private Subject subject;
private Clazz clazz;
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
public Integer getClazzId() {
return clazzId;
}
public void setClazzId(Integer clazzId) {
this.clazzId = clazzId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getJoinDate() {
return joinDate;
}
public void setJoinDate(Date joinDate) {
this.joinDate = joinDate;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStuName() {
return stuName;
}
public void setStuName(String stuName) {
this.stuName = stuName;
}
public String getStuNo() {
return stuNo;
}
public void setStuNo(String stuNo) {
this.stuNo = stuNo;
}
public String getStuPwd() {
return stuPwd;
}
public void setStuPwd(String stuPwd) {
this.stuPwd = stuPwd;
}
public Integer getSubjectId() {
return subjectId;
}
public void setSubjectId(Integer subjectId) {
this.subjectId = subjectId;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public Subject getSubject() {
return subject;
}
public void setSubject(Subject subject) {
this.subject = subject;
}
public Clazz getClazz() {
return clazz;
}
public void setClazz(Clazz clazz) {
this.clazz = clazz;
}
public static class StatusType{
public static String type_1 = "正常";
public static String type_2 = "辍学";
public static String type_3 = "休学";
public static String type_4 = "复学";
public static String type_5 = "转学";
public static String type_6 = "转入";
public static String type_7 = "毕业";
}
}
studentDao接口文件
package com.xiaoqiang.dao;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.xiaoqiang.entity.Student;
public interface StudentDao {
public int create(Student pi);
public int delete(Map<String, Object> paramMap);
public int update(Map<String, Object> paramMap);
public List<Student> query(Map<String, Object> paramMap);
public Student detail(Map<String, Object> paramMap);
public int count(Map<String, Object> paramMap);
public List<HashMap> querySelectStudent(Map<String, Object> paramMap);
public List<Student> queryStudentByTeacher(Map<String, Object> paramMap);
}
StudentService.java
package com.xiaoqiang.service;
import com.xiaoqiang.dao.StudentDao;
import com.xiaoqiang.dao.StudentDao;
import com.xiaoqiang.entity.Student;
import com.xiaoqiang.entity.Teacher;
import com.xiaoqiang.utils.BeanMapUtils;
import com.xiaoqiang.utils.MD5Utils;
import com.xiaoqiang.utils.MapParameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class StudentService {
@Autowired
private StudentDao studentDao;
public int create(Student pi) {
pi.setStuPwd(MD5Utils.getMD5(pi.getStuPwd()));
return studentDao.create(pi);
}
public int delete(Integer id) {
return studentDao.delete(MapParameter.getInstance().addId(id).getMap());
}
public int delete(String ids) {
int flag = 0;
for (String str : ids.split(",")) {
flag = studentDao.delete(MapParameter.getInstance().addId(Integer.parseInt(str)).getMap());
}
return flag;
}
public int update(Student student) {
Map<String, Object> map = MapParameter.getInstance().add(BeanMapUtils.beanToMapForUpdate(student)).addId(student.getId()).getMap();
return studentDao.update(map);
}
public List<Student> query(Student student) {
return studentDao.query(BeanMapUtils.beanToMap(student));
}
public Student detail(Integer id) {
return studentDao.detail(MapParameter.getInstance().addId(id).getMap());
}
public int count(Student student) {
return studentDao.count(BeanMapUtils.beanToMap(student));
}
public Student login(String userName, String password){
Map<String, Object> map = MapParameter.getInstance()
.add("stuNo", userName)
.add("stuPwd", password)
.getMap();
return studentDao.detail(map);
}
public List<HashMap> querySelectStudent(Integer courseId, Integer sectionId){
Map<String, Object> map = MapParameter.getInstance()
.add("courseId", courseId)
.add("sectionId", sectionId)
.getMap();
return studentDao.querySelectStudent(map);
}
public List<Student> queryStudentByTeacher(Integer teacherId,Integer clazzId,Integer subjectId){
Map<String, Object> map = MapParameter.getInstance()
.add("teacherId", teacherId)
.add("clazzId", clazzId)
.add("subjectId", subjectId)
.getMap();
return studentDao.queryStudentByTeacher(map);
}
}
StudentController.java
package com.xiaoqiang.controller;
import com.xiaoqiang.entity.*;
import com.xiaoqiang.entity.Student;
import com.xiaoqiang.service.ClazzService;
import com.xiaoqiang.service.StudentService;
import com.xiaoqiang.service.StudentService;
import com.xiaoqiang.service.SubjectService;
import com.xiaoqiang.utils.MapControll;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/student")
public class StudentController {
private static final String LIST = "student/list";
private static final String ADD = "student/add";
private static final String UPDATE = "student/update";
@Autowired
private StudentService studentService;
@Autowired
private SubjectService subjectService;
@Autowired
private ClazzService clazzService;
@GetMapping("/add")
public String create(ModelMap modelMap){
List<Subject> subjects = subjectService.query(null);
modelMap.addAttribute("subjects",subjects);
return ADD;
}
@PostMapping("/create")
@ResponseBody
public Map<String,Object> create(@RequestBody Student student){
student.setStatus(Student.StatusType.type_1);
int result = studentService.create(student);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}
@PostMapping("/delete/{id}")
@ResponseBody
public Map<String,Object> delete(@PathVariable("id") Integer id){
int result = studentService.delete(id);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}
@PostMapping("/delete")
@ResponseBody
public Map<String,Object> delete(String ids){
int result = studentService.delete(ids);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}
@PostMapping("/update")
@ResponseBody
public Map<String,Object> update(@RequestBody Student student){
int result = studentService.update(student);
if(result<=0){
return MapControll.getInstance().error().getMap();
}
return MapControll.getInstance().success().getMap();
}
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Integer id, ModelMap modelMap){
Student student = studentService.detail(id);
List<Subject> subjects = subjectService.query(null);
modelMap.addAttribute("student",student);
modelMap.addAttribute("subjects",subjects);
return UPDATE;
}
@PostMapping("/query")
@ResponseBody
public Map<String,Object> query(@RequestBody Student student){
List<Student> list = studentService.query(student);
List<Subject> subjects = subjectService.query(null);
List<Clazz> clazzes = clazzService.query(null);
//设置关联关系
list.forEach(entity->{
subjects.forEach(subject -> {
if(subject.getId() == entity.getSubjectId()){
entity.setSubject(subject);
}
});
clazzes.forEach(clazz -> {
if(clazz.getId() == entity.getClazzId()){
entity.setClazz(clazz);
}
});
});
Integer count = studentService.count(student);
return MapControll.getInstance().success().page(list,count).getMap();
}
@GetMapping("/list")
public String list(){
return LIST;
}
@GetMapping("/info")
public String info(HttpSession session,ModelMap modelMap){
//获取Student
Student param = (Student) session.getAttribute("user");
Student student = studentService.detail(param.getId());
modelMap.put("student",student);
return "student/info";
}
@GetMapping("/teacher_student")
public String teacher_student(HttpSession session,ModelMap modelMap){
Teacher teacher = (Teacher) session.getAttribute("user");
List<Clazz> clazzes = clazzService.query(null);
List<Subject> subjects = subjectService.query(null);
modelMap.addAttribute("clazzes",clazzes);
modelMap.addAttribute("subjects",subjects);
modelMap.addAttribute("teacherId",teacher.getId());
return "student/teacher_student";
}
@PostMapping("/teacher_student")
@ResponseBody
public Map<String,Object> teacher_student(Integer teacherId,Integer clazzId,Integer subjectId){
List<Student> students = studentService.queryStudentByTeacher(teacherId, clazzId, subjectId);
List<Subject> subjects = subjectService.query(null);
List<Clazz> clazzes = clazzService.query(null);
//设置关联关系
students.forEach(entity->{
subjects.forEach(subject -> {
if(subject.getId() == entity.getSubjectId()){
entity.setSubject(subject);
}
});
clazzes.forEach(clazz -> {
if(clazz.getId() == entity.getClazzId()){
entity.setClazz(clazz);
}
});
});
return MapControll.getInstance().success().add("data",students).getMap();
}
}
四、获取途径
(Java课设)学生成绩管理系统(ssm版) - 九鸟网 (jiuniao.com)
该项目为本人简易的demo,其中不乏有许多设计不妥之处,还望大佬指点一二~